Closed gmlewis closed 2 months ago
how does other languages deal with this issue?
The difference is explained here: WASI Application ABI
One is a WASI 0.1 command and one is a WASI 0.1 reactor.
You can specify it like so in clang (or other LLVM based projects): https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mexec-model
I believe this changed to some degree with WASI 0.2, so you may have to consider that.
Closely related to this issue is that I needed to add the wat expression (export "memory" (memory $moonbit.memory))
to get the wasm to work correctly with Extism.
Closely related to this issue is that I needed to add the wat expression
(export "memory" (memory $moonbit.memory))
to get the wasm to work correctly with Extism.
You can configure it with "export-memory-name": "custom_memory_name"
in the link.wasm
of moon.pkg.json
You can configure it with
"export-memory-name": "custom_memory_name"
in thelink.wasm
ofmoon.pkg.json
Thank you, @peter-jerry-ye ! That worked perfectly.
The init function will become start function after today's release. If there's anything that relies on the initialized instance, then user can export a public function, such as
pub fn initialize() -> Unit {
}
or
pub fn start() -> Unit {
}
and define the alias in the moon.pkg.json
In this Discord discussion: https://discord.com/channels/1011124058408112148/1246483784740900874 G4Vi discovered that Extism initializes a WASM module by first calling "_initialize" if it exists.
To address this, I'm planning on compiling to WAT, changing this line:
to:
and compiling back to WASM, but it would be nice to add a compiler flag so that this name can be chosen during
moon build
.