Stream: wit-bindgen

Topic: ✔ wit-bindgen js in the browser


view this post on Zulip Jens Gåsemyr Magnus (Jul 14 2022 at 18:01):

Hey, I've written a small module in rust and define the API in wit. I was wondering how this module can be instantiated in the browser, or how I would get the wasi_snapshot_preview1 imports for the module to use.

view this post on Zulip Jens Gåsemyr Magnus (Jul 14 2022 at 18:31):

So the obvious solution that came to me after asking the question is that rather than compiling for wasm32-wasi, it's enough to compile it for target wasm32-unknown-unknown. This seems to work, but is there anything I'm missing here?

view this post on Zulip Mossaka (Joe) (Aug 15 2022 at 20:04):

If you are using wasmtime SDK in the host, you should be able to add WASI to the linker like this:
wasmtime_wasi::add_to_linker(&mut linker, |s| s)?;, and then compile the module to wasm32-wasi and load into the host.

See more: https://docs.wasmtime.dev/examples-rust-wasi.html

view this post on Zulip Notification Bot (Aug 21 2022 at 09:20):

Jens Gåsemyr Magnus has marked this topic as resolved.


Last updated: Nov 22 2024 at 17:03 UTC