Skip to content

Commit 15bcfb0

Browse files
author
Le Yao
committed
Fix the wrong link field init
Signed-off-by: Le Yao <[email protected]>
1 parent 1d7d65c commit 15bcfb0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/wamr/wamr.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ bool Wamr::link(std::string_view /*debug_name*/) {
296296
return false;
297297
}
298298

299-
wasm_extern_vec_t imports_vec = {imports.size(), imports.data()};
299+
//TODO workaround
300+
// it's better to create `wasm_extern_vec_t` via `wasm_extern_vec_new_xxx()`
301+
// maybe one solution is to replace `std::vector<wasm_extern_t *>>` with `wasm_extern_vec_t`
302+
// to avoid a data copy
303+
wasm_extern_vec_t imports_vec = {imports.size(), imports.data(), imports.size()};
300304
instance_ = wasm_instance_new(store_.get(), module_.get(), &imports_vec, nullptr);
301305
if (instance_ == nullptr) {
302306
fail(FailState::UnableToInitializeCode, "Failed to create new Wasm instance");

0 commit comments

Comments
 (0)