jovanivanovic edited Issue #2206:
Hello, I haven't found a way to set a name to the imported function, am I missing something here?
wasm_functype_t *core_ty = wasm_functype_new_0_1(wasm_valtype_new_i32()); wasm_func_t *core = wasm_func_new_with_env(store, core_ty, WasmExports::ICore_Instance, wasmResource, nullptr); wasm_functype_delete(core_ty);
Or even setting a namespace for the import?
alexcrichton commented on Issue #2206:
Currently we don't have an API for this in either Rust or C. Can you elaborate your use case of editing the exported name of a function?
jovanivanovic commented on Issue #2206:
@alexcrichton So, I am not sure how wasmtime creates imports and gives them proper names, but everytime I have more than 1 import it gives me an error that the function signatures don't match with the host and the module if the module imports are in different order than how I set them in the host.
alexcrichton commented on Issue #2206:
Hm would you be able to share some code? The imported function's name is never specified in the C API, and
wasm_instance_new
is based on the order of imports in the wasm module. If you'd like to perform name-based resolution you can use thewasmtime_linker_t
type which allows you to, within the context of a linker, specify the name of awasm_func_t
jovanivanovic commented on Issue #2206:
Yeah, in the meantime we switched to using linker. Thanks for your help @alexcrichton
jovanivanovic closed Issue #2206:
Hello, I haven't found a way to set a name to the imported function, am I missing something here?
wasm_functype_t *core_ty = wasm_functype_new_0_1(wasm_valtype_new_i32()); wasm_func_t *core = wasm_func_new_with_env(store, core_ty, WasmExports::ICore_Instance, wasmResource, nullptr); wasm_functype_delete(core_ty);
Or even setting a namespace for the import?
Last updated: Dec 23 2024 at 12:05 UTC