wasmtime-java
wasmtime-java copied to clipboard
Is there a MemoryInterop example with C++
I generate .wasm from cpp with emcc , pass malloc address to java, but can not read value by ByteBuffer, also can not modify value by ByteBuffer when read value in c++ later. By the way, when pass const char* address to java, can read value correctly.
wasm module/runtime can read/write from/to linear memory only https://wasmbyexample.dev/examples/webassembly-linear-memory/webassembly-linear-memory.rust.en-us.html so maybe the address you're passing around isn't valid in that regard.
Anyway, without more information provided there's too many possibilities to guess. One thing you can do is to try running your wasm module using wasmtime
command directly, and if it still fails that is a problem of either wasntime runtime or your compiled wasm module.