-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Scenario:
I want to use wai_bindgen_wasmer to create a Rust program that would import WASM plugins, and then run that program on a webpage. I unserstand that's what the js feature is for, but it is not working for me.
Just to re-itarate, i DO NOT want to import the WASM plugin in JS runtime.
The problem:
When I use the wai_bindgen_wasmer runtime and compile that to WASM using wasm-pack, I get this error at runtime: panicked at 'should create instance: Incompatible Export Type', src\lib.rs:41:14 (source)
fn get_color() -> protocol_plugin::Color {
let mut store = Store::new(Engine::default());
let module = Module::new(&store, PLUGIN_BYTES).expect("should create module");
let (plugin, _) =
protocol_plugin::ProtocolPlugin::instantiate(&mut store, &module, &mut imports! {})
.expect("should create instance"); // <-- HERE
plugin.get_color(&mut store).expect("should get color")
}I tried cloning the wai repo and using that instead, and it actually throws a different error: panicked at 'not implemented: direct data pointer access is not possible in JavaScript', C:\Programs\Cargo\bin\registry\src\github.com-1ecc6299db9ec823\wasmer-3.1.1\src\js\externals\memory_view.rs:87:9
The code is the same as above.
Steps to reproduce:
Clone this repo at the wasm-pack-example-two-errors tag, and then clone https://github.com/wasmerio/wai.git into the repository. See the run-wasm-only.sh and run-wasm-only-forked.sh scripts on how to run the example.