Stream: general

Topic: Linking modules from wasmtime cli


view this post on Zulip David Lang (May 11 2021 at 09:05):

Hi,
Is it possible to link two wasm modules together from the wasmtime CLI?
I've tried to preload a module but it didn't work:
wasmtime run --preload NAME=linking2.wasm linking1.wasm

output:
Error: failed to run main module linking1.wasm

Caused by:
0: failed to instantiate "linking1.wasm"
1: unknown import: linking2::double has not been defined

The modules are taken from the linking tutorial:
https://docs.wasmtime.dev/examples-rust-linking.html

Thanks for your help

view this post on Zulip Till Schneidereit (May 11 2021 at 12:34):

Hi David, that's not yet possible, unfortunately, but something at least in this direction will work in the future.

Right now the problem is that the wasmtime CLI doesn't really have enough information to go on: it can't know that the preloaded Wasm file is what's meant when referring to linking2. While we in theory could just map file names to module names, we want to make sure that what we implement here will make sense in the long run, and that requires some amount of careful design

view this post on Zulip David Lang (May 11 2021 at 13:52):

Hi Till,
thanks for your help :)


Last updated: Nov 22 2024 at 16:03 UTC