I'm toying around with a simple wit definition and it's generated code: I implemented the Rust side, and a way to call it from js (in the browser):
record FeatureDescription {
name: string,
description: string,
}
// Return the list of supported features.
get_features: function() -> list<FeatureDescription>
let plugins = new Plugins();
await plugins.instantiate(
fetch("./target/wasm32-unknown-unknown/release/witplugins.wasm")
);
console.log(`Features: `, plugins.getFeatures());
the getFeatures()
call fails because the JS side expects a "canonical_abi_free" export which is not provided. What am I missing on the Rust side?
Thanks!
Nevermind, I figured it out thanks to the discussion in https://github.com/bytecodealliance/wit-bindgen/issues/59 : using wit_bindgen_rust::export!(...)
instead of manually importing the Rust generated code does the trick!
Fabrice Desré has marked this topic as resolved.
Last updated: Nov 22 2024 at 16:03 UTC