Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218)
Remove the unused parameter `signature` from `wasm_runtime_lookup_function`. Refactor the layout of WASMModuleInstance structure: - move common data members `c_api_func_imports` and `cur_exec_env` from `WASMModuleInstanceExtraCommon` to `WASMModuleInstance` - In `WASMModuleInstance`, enlarge `reserved[3]` to `reserved[5]` in case that we need to add more fields in the future ps. https://github.com/bytecodealliance/wasm-micro-runtime/issues/2530 https://github.com/bytecodealliance/wasm-micro-runtime/issues/3202
This commit is contained in:
@ -100,7 +100,7 @@ After a module is instantiated, the runtime embedder can lookup the target WASM
|
||||
```c
|
||||
/* lookup a WASM function by its name
|
||||
The function signature can NULL here */
|
||||
func = wasm_runtime_lookup_function(module_inst, "fib", NULL);
|
||||
func = wasm_runtime_lookup_function(module_inst, "fib");
|
||||
|
||||
/* creat an execution environment to execute the WASM functions */
|
||||
exec_env = wasm_runtime_create_exec_env(module_inst, stack_size);
|
||||
|
||||
@ -62,8 +62,7 @@ WAMR hopes that the native host or embedding environment loads/unloads the modul
|
||||
```c
|
||||
wasm_function_inst_t
|
||||
wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
|
||||
const char *name,
|
||||
const char *signature);
|
||||
const char *name);
|
||||
```
|
||||
|
||||
Multi-module allows one to look up an exported function of a submodule. There are two ways to indicate the function _name_:
|
||||
|
||||
@ -288,7 +288,7 @@ And in the host embedder:
|
||||
bool ret;
|
||||
|
||||
argv[0] = *(uint32 *)&arg_f32;
|
||||
func = wasm_runtime_lookup_function(module_inst, "foo1", NULL);
|
||||
func = wasm_runtime_lookup_function(module_inst, "foo1");
|
||||
ret = wasm_runtime_call_wasm(exec_env, func, 1, argv);
|
||||
if (!ret) {
|
||||
/* handle exception */
|
||||
|
||||
Reference in New Issue
Block a user