I have a library written in Zig. It exports functions to wasm using export fn example() void {}. However when I compile it there are no exports available in WASM. I'm using this command to compile
zig build-lib -O ReleaseSmall -target wasm32-freestanding src/wasm-bind.zig. The only function getting exported is an empty function named _start which does nothing and returns nothing.
#How to compile library to wasm?
1 messages · Page 1 of 1 (latest)
See %%10517 I believe
or maybe it's just the same issue as https://discord.com/channels/605571803288698900/1165477693152833538
I added "-rdynamic" and it didn't change anything
I don't understand what rdynamic even does
me neither
-rdynamic exports the symbols of an executable
well my symbols still aren't getting exported even though I added the rdynamic flag
I mean if I become desperate I could just make the main function act as a wrapper function for all the library functions, but I'd rather not and wish the compiler would just export the library functions like I told it to
what about -dynamic as well?
LETS GOOO!
It works.
I have written my own implementation of HTML Canvas in Zig.
I have compiled it to WASM.
I have rendered a graphic using zig-html-canvas and displayed the output in a real HTML Canvas.
Truly we are living in the future.
yes this made it work thanks :D