Skip to content

C: Compile with -fvisibility=hidden flag#906

Merged
marcoroth merged 1 commit into
marcoroth:mainfrom
timkaechele:visibility-issues
Nov 26, 2025
Merged

C: Compile with -fvisibility=hidden flag#906
marcoroth merged 1 commit into
marcoroth:mainfrom
timkaechele:visibility-issues

Conversation

@timkaechele

@timkaechele timkaechele commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

This PR starts compiling the ruby herb gem c dependencies with -fvisibility=hidden.

This addresses a criticial bug that lead to crashes when the ruby gem ran in an environment that already had harfbuzz loaded. Both define a function called hb_buffer_append, which resulted in conflicts.

With this fix we only expose the init function required by the ruby runtime in the DLL/SO.

This PR addresses the issues reported in #905

Before

Bildschirmfoto_2025-11-19_um_00 09 11

After

Bildschirmfoto_2025-11-19_um_00 19 23

@github-actions github-actions Bot added the c label Nov 18, 2025
@timkaechele timkaechele force-pushed the visibility-issues branch 2 times, most recently from b7bd0d9 to 64dd9f9 Compare November 18, 2025 22:42
@marcoroth marcoroth merged commit 4f45648 into marcoroth:main Nov 26, 2025
24 checks passed
@timkaechele timkaechele deleted the visibility-issues branch November 26, 2025 07:53
marcoroth added a commit that referenced this pull request Nov 30, 2025
Follow Prism's pattern for controlling symbol visibility when building
shared libraries. The public API in `herb.h/herb.c` is marked with
`HERB_EXPORTED_FUNCTION`, which exports symbols when
`HERB_EXPORT_SYMBOLS` is defined.

For the Ruby extension, only `Init_herb` is exported, all other symbols
(including prism's `pm_*` functions) remain hidden, to prevent future
symbol conflicts with other libraries available on the system.

Follow up on #906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants