Closed tyduptyler13 closed 7 years ago
Nbind will provide an empty Module
object to the asm.js code unless you pass one as the first argument to init
. It doesn't leak the variable from the asm.js wrapper scope, so if you have a custom Module
object, passing it to init
should make everything work as normal and not cause any problems.
The only thing is that if your own Module
has an onRuntimeInitialized
hook, it will be called before nbind_init
and thus shouldn't try to make calls using wrappers defined using nbind.
Thank you for the quick response. I will see what appending a custom module does after I reset the pre.js file to normal.
So calling nbind like so seems to work properly, but now I have other problems I am still swimming around in. They are unrelated to the initial issue though. Thank you for your help.
nbind.init(Module, function(err, binding) { console.log(err, binding); });
NBind seems to fail at runtime when using GLFW3 with emscripten. During testing I would get errors about Module["canvas"] being undefined.
I have fooled around a bit with the pre.js file and discovered two versions of Module floating around in the Object tree and the one attached to the window object has a canvas value. Copying this value to the Module passed to the nbind init seems to get passed this error but still runs into other errors. (I have yet to confirm that these errors are related to nbind at all)
The most important part of this is that static initialization of GLFW3 does not work with nbind and emscripten due to the way the Module object is passed around.
I can create a basic demo later to show you what is going on, if it is needed.