Skip to content

wasm: fix export pub fns in main module when targeting wasi#26041

Merged
spytheman merged 1 commit into
vlang:masterfrom
bradcypert:bradcypert/export-pub-fns-in-main-wasi
Dec 20, 2025
Merged

wasm: fix export pub fns in main module when targeting wasi#26041
spytheman merged 1 commit into
vlang:masterfrom
bradcypert:bradcypert/export-pub-fns-in-main-wasi

Conversation

@bradcypert

Copy link
Copy Markdown
Contributor

Fixes: #25630

The WASM backend was only exporting pub functions when the target OS was .browser. When compiling with -b wasm (which defaults to .wasi target), pub functions were not exported. This prevented tools like wasmer from invoking the functions.

I've updated the logic to determine public exports in the main module to also include the .wasi target. Not entirely sure what a test for this would look like without adding a dependency on something like wasmer (or parsing the generated output file, maybe?)

@spytheman

Copy link
Copy Markdown
Contributor

Excellent work, thank you.
I'll add a test, do not worry about it.

@spytheman spytheman merged commit 60f7c81 into vlang:master Dec 20, 2025
73 of 74 checks passed
@spytheman

Copy link
Copy Markdown
Contributor

The test is in #26048 .

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.

example examples/wasm/functions.v fails

2 participants