Hi. I'm playing around with building a plugin interface using wasmtime, with wit-bindgen to (hopefully) give me access to the component-model types (strings and such). I've managed to dig my way to something that works for the guest (my plugin) to call host functions that give and take strings, and the host can call guest functions that take no arguments, but I'm getting a "cannot reenter component instance" error when trying to call guest functions that take arguments from the host.
I suspect this is a case of mismatched tooling support, since i'm using wasmtime main
to get wasmtime::component::generate!
for my host but using the latest wasm-tools from crates.io and wit-bindgen-guest-rust main
for my guest. But there's also a large chance i'm just doing something wrong. My code is here https://github.com/tristan/wasm-plugin-experiment. :fingers_crossed: someone can either point out my mistake, or confirm for me I just need to take a break from it until the tooling is more aligned.
Are you able to perhaps turn on wasm backtraces and capture the error? If you're getting so far as "cannot reenter" you've got all the tooling versions aligned, but there may still be a bug in the component itself
Oh! Sorry no, you'll need to call .post_return()
on component functions in the embedder if you're not invoking the functions through the generated bindings
which should fix your issue
Yes! That fixed it. thanks! :praise:
Tristan has marked this topic as resolved.
Last updated: Nov 22 2024 at 16:03 UTC