Stream: git-wasmtime

Topic: wasmtime / Issue #2206 Set imported function's name in C ...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 17 2020 at 11:58):

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?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 18 2020 at 19:17):

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?

view this post on Zulip Wasmtime GitHub notifications bot (Sep 19 2020 at 21:43):

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.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 22 2020 at 17:20):

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 the wasmtime_linker_t type which allows you to, within the context of a linker, specify the name of a wasm_func_t

view this post on Zulip Wasmtime GitHub notifications bot (Sep 24 2020 at 17:49):

jovanivanovic commented on Issue #2206:

Yeah, in the meantime we switched to using linker. Thanks for your help @alexcrichton

view this post on Zulip Wasmtime GitHub notifications bot (Sep 24 2020 at 17:49):

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: Nov 22 2024 at 17:03 UTC