[Question] How to do the equivalent of the wasmtime cli wasmtime run <name>.wasm
from the API?
I am using the component model to design a plugin system.
As I understand it, the way to go is that each plugin implements the published WIT, and after compiling a component, the .wasm is transformed to a command wasm by composing it. Then, each plugin will be basically a CLI.
I am trying to run these CLIs from the wasmtime API in my app (instead of asking the user to install the wasmtime cli and run it as a command).
Maybe, I am doing something wrong and I do not need the roundtrip of transforming a wasm component to a wasm command component to run it. If so, then is there a working example I can use as reference?
That's a hard question to answer succinctly; wasmtime run
does a lot of things, many of which you probably don't care about. You can see a basic example of running a component with a custom interface here (see the parent dir's README for build instructions).
Thank you for the example!
I agree that it would be an overkill, and I do not need to do everything that run
does.
For future reference, I found this talk particularly useful
The code implements the same that you linked, possibly in a way where the decoupling of plugins and host is clearer.
Raimundo Saona has marked this topic as resolved.
Last updated: Nov 22 2024 at 17:03 UTC