Error String: Uncaught (in promise) LinkError: WebAssembly Instantiation: Import #2 module="env" function="_printf" error: function import requires a callable
Here is my source
#include <stdio.h>
extern "C" int test()
{
printf("OK");
return 0;
}
loadWebAssembly("main.wasm").then(instance => {
instance.exports._test();
});
when I set a importObjects like this, but console allways log '0'.
var imports = {
env: {
_printf: msg => console.log(msg)
}
};
I'm not find the relationship of var type between 'js' and 'cpp' in emscripten, what should i do, how to link to WebGL2(unusefull when I add "-s USE_WEBGL2=1"), thinks!