Stream: wasmtime

Topic: loading and dropping modules


view this post on Zulip CreponneKarim (Mar 06 2024 at 13:05):

So i'm trying to code am application that allows for receiving wasm modules for execution. And so im trying to load and drop modules to the linker, but i just noticed that there is no drop mechanism included in the linker; from that, i can conclude that (A) i'm not using the linker how it should be used, and (B) there is an alternative surely that im not aware of.
So how do i do that, load and drop modules without having to create a linker each time ?
thank you in advance !

view this post on Zulip Lann Martin (Mar 06 2024 at 13:35):

There may be alternative ways to structure your application to allow reuse of a single linker but you are correct that you cannot remove linked items. Is there a particular problem with creating a new Linker each time?

view this post on Zulip Lann Martin (Mar 06 2024 at 13:38):

One possible alternative may be to replace items rather than removing them. There is an option to allow shadowing which may do what you need, though I've only seen it used to replace individual functions, not entire modules.

view this post on Zulip CreponneKarim (Mar 06 2024 at 13:55):

Lann Martin said:

There may be alternative ways to structure your application to allow reuse of a single linker but you are correct that you cannot remove linked items. Is there a particular problem with creating a new Linker each time?

Overhead mainly, but i think that's not that big of a deal; i can probably recreate the linker since it doesn't really affect the performance all that much, but it would've been nice to have that option.

view this post on Zulip CreponneKarim (Mar 06 2024 at 13:59):

Lann Martin said:

One possible alternative may be to replace items rather than removing them. There is an option to allow shadowing which may do what you need, though I've only seen it used to replace individual functions, not entire modules.

also since I'm pretty new to wasm and wasmtime, i would like to know if it is possible to only load an export from a module, and not the full module to the linker.
Thank you !

view this post on Zulip Lann Martin (Mar 06 2024 at 14:02):

i would like to know if it is possible to only load an export from a module, and not the full module to the linker

Not really, no, though it would be interesting to here why you would like this


Last updated: Nov 22 2024 at 17:03 UTC