#WebAssembly example not working
1 messages · Page 1 of 1 (latest)
Docs are out of date, you need --export add
zig build-lib math.zig -target wasm32-freestanding -dynamic --export add
doesn't work either: error: unrecognized parameter: '--export'
i'll try updating zig
Oh, maybe it's --export=add sorry
that works! thanks
:)
test.js works now too
2 additional questions:
- should I/can I update the docs? (by opening an issue or making a pr)
- if I make more functions, do I need to add all of them to the build command??
the code already has an export before the function, what is the motivation for the --export flag?
sure, a PR to update the docs would be great!
Yes, you need to export all of them - you can do it in build.zig if you want
You can read about why this change was done here: https://github.com/ziglang/zig/pull/14102