Stream: general

Topic: wit-bindgen for Modules


view this post on Zulip Amit Prasad (Nov 23 2022 at 20:17):

Is it possible to use wit-bindgen to generate host and guest bindings for use with non-component WASM (i.e.: plain old modules)?

view this post on Zulip Pat Hickey (Nov 24 2022 at 03:20):

For the guest bindings, all tookchains presently emit core Wasm modules, plus a custom section that contains the component type information. Wit-component can translate those modules to a component

view this post on Zulip Pat Hickey (Nov 24 2022 at 03:21):

For host bindings, the answer is more complicated. Wasmtime has a component runtime, so the host bindings generated simply use that. But JavaScript does not have a component runtime, so wit-bindgen emits the JavaScript code that implements one for the given component type

view this post on Zulip Pat Hickey (Nov 24 2022 at 03:23):

If you want to target another host wasm runtime that doesn’t have a component runtime, you can follow the general way the js host binding generation works to generate host code that uses the Wasm runtime to implement a runtime for that particular component type.

view this post on Zulip Pat Hickey (Nov 24 2022 at 03:25):

Also just fyi the host generators are moving to new homes, for software engineering reasons. They will still work the same way, they just won’t be used through the wit-bindgen cli https://github.com/bytecodealliance/wit-bindgen/issues/395

This was discussed at the wit-bindgen meeting last Friday, and after some futher discussion with @pchickey I've come up with a proposal which I personally feel is the direction that wit-bindgen...

view this post on Zulip Amit Prasad (Nov 24 2022 at 07:34):

Thanks @Pat Hickey. To clarify -- I want to use wit-bindgen with the non-component runtime in Wasmtime, so that I can use WASI (since component WASI is still very WIP). I suppose this isn't straightforward?

view this post on Zulip Pat Hickey (Nov 24 2022 at 16:46):

Nope this isn’t possible. Sit tight and we will land wasi support as soon as we can


Last updated: Dec 23 2024 at 13:07 UTC