mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 21:26:21 +00:00
fix command-reactor: Look for _initialize only if _start not found (#2891)
A wasm module can be either a command or a reactor, so it can export either `_start` or `_initialize`. Currently, if a command module is run, `iwasm` still looks for `_initialize`, resulting in the warning: `can not find an export 0 named _initialize in the module`. Change to look for `_initialize` only if `_start` not found to resolve the issue.
This commit is contained in:
parent
c6848e45a1
commit
6cb2ea4935
|
@ -3994,19 +3994,23 @@ check_wasi_abi_compatibility(const WASMModule *module,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
/* (func (export "_initialize") (...) */
|
/* (func (export "_initialize") (...) */
|
||||||
initialize = wasm_loader_find_export(
|
initialize =
|
||||||
module, "", "_initialize", EXPORT_KIND_FUNC, error_buf, error_buf_size);
|
wasm_loader_find_export(module, "", "_initialize", EXPORT_KIND_FUNC,
|
||||||
if (initialize) {
|
error_buf, error_buf_size);
|
||||||
WASMType *func_type =
|
if (initialize) {
|
||||||
module->functions[initialize->index - module->import_function_count]
|
WASMType *func_type =
|
||||||
->func_type;
|
module
|
||||||
if (func_type->param_count || func_type->result_count) {
|
->functions[initialize->index
|
||||||
set_error_buf(
|
- module->import_function_count]
|
||||||
error_buf, error_buf_size,
|
->func_type;
|
||||||
"the signature of builtin _initialize function is wrong");
|
if (func_type->param_count || func_type->result_count) {
|
||||||
return false;
|
set_error_buf(
|
||||||
|
error_buf, error_buf_size,
|
||||||
|
"the signature of builtin _initialize function is wrong");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user