gpt4 book ai didi

webassembly - 类型错误 : WebAssembly Instantiation: Imports argument must be present and must be an object

转载 作者:行者123 更新时间:2023-12-04 03:00:30 28 4
gpt4 key购买 nike

我正在关注这个“ Hello World ”教程:
https://steemit.com/eos/@skenan/eos-development-for-beginners-webassembly
我收到这个错误:

TypeError: WebAssembly Instantiation: Imports argument must be present and must be an object


知道是什么原因造成的吗?

最佳答案

您收到此错误的原因可能是:
当您启动 webassembly 实例时,您还需要指定导入对象。就像:

WebAssembly.instantiate(module, imports);

好吧,这里我只是举一个简单的例子来演示步骤:
    imports.env = imports.env || {}

Object.assign(imports.env, {
tableBase: module.tableBase,
table: new WebAssembly.Table({
initial: 4,
element: 'anyfunc',
}),
print:function(msg){
console.log(msg);
}
});
return new WebAssembly.Instance(module, imports)

关于webassembly - 类型错误 : WebAssembly Instantiation: Imports argument must be present and must be an object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49635240/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com