diff --git a/emsdk/emscripten/tag-1.38.30/src/support.js b//emsdk/emscripten/tag-1.38.30/src/support.js index 8e1df8e82..4d07d6bef 100644 --- a/emsdk/emscripten/tag-1.38.30/src/support.js +++ b/emsdk/emscripten/tag-1.38.30/src/support.js @@ -437,7 +437,18 @@ function loadWebAssemblyModule(binary, flags) { // present in the dynamic library but not in the main JS, // and the dynamic library cannot provide JS for it. Use // the generic "X" invoke for it. - return env[prop] = invoke_X; + var dynCallName = 'dynCall_' + prop.slice(7); + return env[prop] = function() { + var sp = stackSave(); + try { + var args = Array.prototype.slice.call(arguments); + return Module[dynCallName].apply(null, args); + } catch(e) { + stackRestore(sp); + if (typeof e !== 'number' && e !== 'longjmp') throw e; + Module["setThrew"](1, 0); + } + } } // if not a global, then a function - call it indirectly return env[prop] = function() { @@ -502,6 +513,11 @@ function loadWebAssemblyModule(binary, flags) { } #endif } + if (e.startsWith("dynCall_")) { + if (!Module.hasOwnProperty(e)) { + Module[e] = value; + } + } exports[e] = value; } // initialize the module