My code looks like this:
// api.h
extern uintptr_t host_create_resource(char* dataString);
// WASI module main.c
#include <api.h>
int main() {
host_create_resource("hello, world!");
return 0;
}
The compiled WASM file (converted to WAT), does not contain externref function parameters. The return value of host_create_resource
is marked as i32.
I can't figure out how to make the final WASM module use the ref-types feature. My runtime is WAMR. I noticed the issue because the host function implementation looks like this:
uintptr_t
host_create_resource_wrapper(wasm_exec_env_t exec_env, char* msg) {
return 0;
}
static nativeSymbols = {
REG_NATIVE_FUNC(host_create_resource, "($)r")
}
The linking fails at runtime. iwasm
cannot find a function that matches the signature ($)r
. And that makes sense. The type of host_create_source
is (type (;4;) (func (param i32) (result i32)))
.
Thank you!
Last updated: Apr 07 2025 at 06:04 UTC