You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use the code like the tutorial , #[no_mangle] pub extern fn sum(x: i32, y: i32) -> i32 { x + y }
and use: cargo build --target=wasm32-wasi to compile my rust code to .wasm file.
and I run the .wasm file like this wasmtime hello-rust2wasm.wasm, it can worked.
but when I call the .wasm file in Java it comes an error. Exception in thread "main" java.lang.RuntimeException: Failed to instantiate the module: Error while importing "wasi_snapshot_preview1"."fd_write": unknown import. Expected Function(FunctionType { params: [I32, I32, I32, I32], results: [I32] })
but if I use the author's file simple.wasm show in README. it can work.
so I want to know how the author compiles the rust to wasm and where I can learn the method.
Additional details
Provide any additional details here.
The text was updated successfully, but these errors were encountered:
Summary
I use the code like the tutorial ,
#[no_mangle] pub extern fn sum(x: i32, y: i32) -> i32 { x + y }
and use:
cargo build --target=wasm32-wasi
to compile my rust code to.wasm
file.and I run the
.wasm
file like thiswasmtime hello-rust2wasm.wasm
, it can worked.but when I call the .wasm file in Java it comes an error.
Exception in thread "main" java.lang.RuntimeException: Failed to instantiate the module: Error while importing "wasi_snapshot_preview1"."fd_write": unknown import. Expected Function(FunctionType { params: [I32, I32, I32, I32], results: [I32] })
but if I use the author's file
simple.wasm
show in README. it can work.so I want to know how the author compiles the rust to wasm and where I can learn the method.
Additional details
Provide any additional details here.
The text was updated successfully, but these errors were encountered: