#How to compile library to wasm?

1 messages · Page 1 of 1 (latest)

rancid mist
#

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.

tulip plume
#

See %%10517 I believe

rancid mist
#

I added "-rdynamic" and it didn't change anything

#

I don't understand what rdynamic even does

tulip plume
#

me neither

rancid mist
#

-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

grim halo
#

what about -dynamic as well?

rancid mist
#

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.

rancid mist