pyodide/emsdk/patches/dynCall_so.patch

37 lines
1.4 KiB
Diff
Raw Normal View History

2019-04-04 11:57:47 +00:00
diff --git a/emsdk/emscripten/tag-1.38.30/src/support.js b//emsdk/emscripten/tag-1.38.30/src/support.js
2019-01-16 21:57:46 +00:00
index 8e1df8e82..4d07d6bef 100644
2019-04-04 11:57:47 +00:00
--- a/emsdk/emscripten/tag-1.38.30/src/support.js
+++ b/emsdk/emscripten/tag-1.38.30/src/support.js
2019-01-16 21:57:46 +00:00
@@ -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;
+ }
+ }
2019-01-16 21:57:46 +00:00
exports[e] = value;
}
2019-01-16 21:57:46 +00:00
// initialize the module