You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, a trap occurred during wasm_instance_new_with_args:
"wasm_instance_new_with_args_ex failed: WASM module instantiate failed: failed to link import table (js, tbl)"
How to avoid this error
The text was updated successfully, but these errors were encountered:
The issue is due to the handling of WebAssembly's import and table in different environments.
In your module, you are importing a table from the JavaScript environment ("js" namespace), which is typical for running WebAssembly in a browser. The import expects a table to be provided by the host environment (in this case, JavaScript), which is automatically handled by the browser's WebAssembly environment.
However, standalone WebAssembly runtimes like WAMR or Wasmtime don't automatically provide such an import from a JavaScript host, and they don't have a default environment like a browser. Instead, you need to explicitly define the imported table and any associated functions in the host application(or just change it to a non-import one like below).
I wrote a simple demo to run table-related WebAssembly:
https://github.com/mdn/webassembly-examples/blob/main/js-api-examples/table2.wat
However, a trap occurred during wasm_instance_new_with_args:
"wasm_instance_new_with_args_ex failed: WASM module instantiate failed: failed to link import table (js, tbl)"
How to avoid this error
The text was updated successfully, but these errors were encountered: