Merged
Conversation
Adds __wasm_export_ prefix to all C ABI export function names
When a WIT world exports a function whose name matches the world/package
name (e.g., world "foo" with export function "foo"), the generated C ABI
function name foo() conflicted with the C++ namespace namespace foo.
This generates functions like:
```c
extern "C" __attribute__((__export_name__("foo")))
uint8_t * __wasm_export_foo() // C++ function name
```
The public C++ API is `exports::foo::Foo()`.
Users never see the __wasm_export_foo() function in the bindings.
Signed-off-by: Bailey Hayes <[email protected]>
Signed-off-by: Bailey Hayes <[email protected]>
Signed-off-by: Bailey Hayes <[email protected]>
8a16afc to
33ad8c0
Compare
Merged
cpetig
approved these changes
Nov 19, 2025
Collaborator
cpetig
left a comment
There was a problem hiding this comment.
Apart from this curiosity everything simply looks good to me. Thanks a lot for this improvement.
PS: On my personal branch I have a pending patch to move resources into the error path - there you need to wrap expected in an optional to gain a default constructor again.
Signed-off-by: Bailey Hayes <[email protected]>
Merged
via the queue into
bytecodealliance:main
with commit Nov 19, 2025
0e324eb
21 of 22 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds on #1420 and must be merged after.
Adds _wasm_export prefix to all C ABI export function names
When a WIT world exports a function whose name matches the world/package
name (e.g., world "foo" with export function "foo"), the generated C ABI
function name foo() conflicted with the C++ namespace namespace foo.
This generates functions like:
The public C++ API is
exports::foo::Foo().Users never see the __wasm_export_foo() function in the bindings.