Skip to content

fix: export generated C/C++ ABI symbols under hidden visibility#25

Merged
owenthcarey merged 2 commits into
mainfrom
fix/c-abi-symbol-visibility
Jun 29, 2026
Merged

fix: export generated C/C++ ABI symbols under hidden visibility#25
owenthcarey merged 2 commits into
mainfrom
fix/c-abi-symbol-visibility

Conversation

@owenthcarey

@owenthcarey owenthcarey commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Generated C and C++ headers now tag every exported prototype with a portable WEAVEFFI_API visibility macro, so a non-Rust backend that implements the header exports its symbols even under hidden default visibility (-fvisibility=hidden, the release-build norm and the MSVC default). Consumers resolve it to __declspec(dllimport) on Windows; it's benign elsewhere. Deprecated functions use a companion WEAVEFFI_DEPRECATED macro that also compiles under MSVC.

Changes

  • Tag all C ABI prototypes (runtime helpers, functions, struct/enum ops) via the shared cabi renderer; emit the macro definitions from the C and C++ generators.
  • Replace the bare __attribute__((deprecated)) with a portable WEAVEFFI_DEPRECATED macro.
  • Add a producer-side conformance lane that builds an implementing C library under -fvisibility=hidden and asserts symbols export.
  • Regenerate C/C++ snapshots; document the macro in the C generator docs and FAQ.

Closes #23

@owenthcarey owenthcarey merged commit fdc5711 into main Jun 29, 2026
21 checks passed
@owenthcarey owenthcarey deleted the fix/c-abi-symbol-visibility branch June 29, 2026 18:34
@ariankordi

Copy link
Copy Markdown

Thanks for the fix! I will test later today and report any more issues.
JSYK I am making a fork soon that will also have a small OpenGL sample to show you how my rendering use case works, demonstrating how I use Emscripten.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Generated C headers do not have visibility attributes

2 participants