Stream: wit-bindgen

Topic: wasi_snapshot_preview1.wasm question


view this post on Zulip Gordon Smith (Apr 06 2023 at 17:55):

So I (finally) got an end to end build working with a c++ guest and a JS host.

Q1 I am coming from emcc and am used to thinking of my wasm file like a DLL or SO file, should I be using wasi_snapshot_preview1.command.wasm or wasi_snapshot_preview1.reactor.wasm?
Q2 When building the c++ code, how do I control which wasi features to enable (or disable)? Initially I want to create a wasm component with no WASI support, to match what I had in my emcc + IDL build (so I can compare the two built wasm files in a browser and NodeJS) at which point I can start introducing some simple WASI support.
Q3 Has anyone thought about creating a vcpkg triplet for wasi-sdk as an optional replacement for the "wasm32-emscripten" triplet?

(Thx in advance)

view this post on Zulip Ramon Klass (Apr 06 2023 at 18:04):

as to your first question, commands have stdin, stdout, stderr and a main function while reactors can export any interface, so reactors are most close to SO libs

view this post on Zulip Gordon Smith (Apr 06 2023 at 18:23):

Ramon Klass said:

as to your first question, commands have stdin, stdout, stderr and a main function while reactors can export any interface, so reactors are most close to SO libs

Thanks - I switched to use that, added -mexec-model=reactor to my CXX_FLAGS and was able to remove my "main" function.
I should be in a good position to start adding some interfaces to my wit file now...


Last updated: Nov 22 2024 at 16:03 UTC