当使用 emcc 的 MODULARIZE=1 选项时,有没有办法为 extern sendToJs函数提供函数:
emcc 编译命令
emcc test.cpp -O3 -s WASM=1 -s MODULARIZE=1 -o test.js
测试.cpp
...
extern void sendToJs(int num);
...
Javascript
const Module = require('test.js');
Module({
wasmBinary: wasmBinary,
// I was hoping this kind of thing might work:
env: {
_sendToJs: num => console.log('fromWasm', num)
}
})
.then(...);