Open SuperIceCN opened 3 years ago
I think that's because your wasm module is recognized as a "command" rather than a "reactor". Please read https://github.com/WebAssembly/WASI/blob/2ccb606926bee332a7b0a486e150d1053a493977/design/application-abi.md#current-unstable-abi this document for the detail.
In short, when your wasm module contains the _start
function, it is recognized as a command type, and for command type an Instance
is created for each function invocation, meaning memory isn't shared between calls of _start
and get
.
You may want to compile your program as reactor-type (perhaps as a a shared object) if you want to share memory between multiple calls.
I have a test and it fails. I don't know why the variable
result
equals to 0.here is the .wat file:
this wat file is compiled from a c source code file with wasi-sdk:
@kawamuray Could please tell me why this happens? Thanks!