Hello, I'm getting started with wasmtime, and want to experiment with a wasm module that I have that requires some imports. Is there a way to specify these via the wasmtime run cli?
@Itay Shakury currently the cli can only implement wasi imports, for other cases you'll need to dive into the api
@Itay Shakury can you describe your use case a bit? We want to make sure that any future support for this addresses real-world use cases, so that'd be really helpful!
@Till Schneidereit I have a wasm module which have some imports: memory, functions that I wanted to test our quickly. I'm aware this is a conceptual challenge - how to implement the imports. I just thought I'd check if by any chance there's a solution which I haven't considered.
@Itay Shakury wasmtime cli supports wasi related imports at this moment. Is embedding wasmtime something you considered? e.g. https://github.com/bytecodealliance/wasmtime/blob/master/docs/embed-rust.md
@Yury Delendik currently I'm just playing around so I started with the cli as that was quickest. after realizing I need imports I looking at embedding (in C), however the wasmtime docs were very poor for this matter so I'm now POCing wasmer.io
@Itay Shakury are you looking at embedding in C? wasmtime provides that via wasm-c-api -- it is not as convenient as rust's but shall provided functionality you need
examples for wasm-c-api can be found at https://github.com/WebAssembly/wasm-c-api/tree/master/example
thanks, I saw that but didn't know where to start, and the lack of explanations was concerning. the wasmer docs were more compelling so I started there. after I grasp wasmer I'll try to look at wasmtime again.
@Itay Shakury it is possible to bind different WASM modules together with the current wasmtime API (similar to how Windows DLLs work). I just hooked it up for my wasmtime wrapper. So it is easy to hook up testing a WASM module using other WASM modules - but writing WAT manually is not nice for more complicated tests. When API is by-value only it is simple - only handling of different memory segments needs special attention.
Last updated: Nov 22 2024 at 16:03 UTC