Stream: wit-bindgen

Topic: Dynamic worlds linking


view this post on Zulip Omer Sadika (Oct 09 2023 at 14:42):

Hi all!

I've been looking for the best way to link worlds dynamically, for example I have two wit worlds:

world runner {
  import runner-impl;
  export runner-interface;

}

world impl {
  export runner-impl;
}

I want to be able in my host (wasmtime) to dynamically select the world impl wasm (i can have a few of wasm files with different impls) every time the runner uses it. I've looked at all tests and example, but I couldn't figure what it the best way to do it.

Thank you

view this post on Zulip Lann Martin (Oct 09 2023 at 14:55):

There isn't a great solution for this yet, but you have a couple of options:

view this post on Zulip Lann Martin (Oct 09 2023 at 14:58):

a 3rd option that _might_ work in your case would be to create a world that includes all the imports that might be used by a component, actually instantiate your component linked against that world, then inspect the Instance::exports


Last updated: Dec 23 2024 at 13:07 UTC