收藏
回答

为什么根据官方文档Linux打包C语言的wasm在小程序中使用报错?

根据MDN文档的介绍https://developer.mozilla.org/zh-CN/docs/WebAssembly/Guides/C_to_Wasm,打包成wasm文件后,在小程序中使用

WXWebAssembly.instantiate('/static/hellonew.wasm'

报错提示

Uncaught (in promise) CompileError: WebAssembly.instantiate(): Compiling functio #11 failed: expected table index 0, found 0 @+1077

我尝试了在html中使用是可以正常运行

回答关注问题邀请回答
收藏

2 个回答

  • 从君华
    从君华
    11-28

    小程序中的 wasm 需要额外写胶水代码特殊处理。

    11-28
    有用
    回复 1
    • 哄哄
      哄哄
      11-28
      根据生成的胶水代码做了单独修改, WebAssembly改为WXWebAssembly, WebAssembly.instantiate改为直接引用wasm的路径,就是要报错expected table index 0, found 0
      11-28
      回复
  • 智能回答 智能回答 本次回答由AI生成
    11-28
    有用
登录 后发表内容