Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
fe16f98a
Commit
fe16f98a
authored
Dec 20, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #283: Handle function pointers in dylib with signatures not in main
parent
09d8afea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
28 deletions
+52
-28
.circleci/config.yml
.circleci/config.yml
+2
-2
emsdk/patches/dynCall_so.patch
emsdk/patches/dynCall_so.patch
+46
-0
src/main.c
src/main.c
+0
-26
test/test_scipy.py
test/test_scipy.py
+4
-0
No files found.
.circleci/config.yml
View file @
fe16f98a
...
...
@@ -18,7 +18,7 @@ jobs:
-
restore_cache
:
keys
:
-
v1-emsdk-{{ checksum "emsdk/Makefile" }}-v1
1
-
-
v1-emsdk-{{ checksum "emsdk/Makefile" }}-v1
2
-
-
run
:
name
:
build
...
...
@@ -36,7 +36,7 @@ jobs:
paths
:
-
./emsdk/emsdk
-
~/.ccache
key
:
v1-emsdk-{{ checksum "emsdk/Makefile" }}-v1
1
-{{ .BuildNum }}
key
:
v1-emsdk-{{ checksum "emsdk/Makefile" }}-v1
2
-{{ .BuildNum }}
-
persist_to_workspace
:
root
:
.
...
...
emsdk/patches/dynCall_so.patch
0 → 100644
View file @
fe16f98a
diff --git a/emsdk/emscripten/tag-1.38.12/src/library.js b/emsdk/emscripten/tag-1.38.12/src/library.js
index 82537bb3e..8e2e43128 100644
--- a/emsdk/emscripten/tag-1.38.12/src/library.js
+++ b/emsdk/emscripten/tag-1.38.12/src/library.js
@@ -1781,6 +1781,12 @@
LibraryManager.library = {
}
}
+ for (var sym in lib_module) {
+ if (sym.startsWith('dynCall_') && !Module.hasOwnProperty(sym)) {
+ Module[sym] = lib_module[sym];
+ }
+ }
+
// Not all browsers support Object.keys().
var handle = 1;
for (var key in DLFCN.loadedLibs) {
diff --git a/emsdk/emscripten/tag-1.38.12/src/support.js b/emsdk/emscripten/tag-1.38.12/src/support.js
index cff68fbe2..3a4e51dca 100644
--- a/emsdk/emscripten/tag-1.38.12/src/support.js
+++ b/emsdk/emscripten/tag-1.38.12/src/support.js
@@ -211,9 +211,21 @@
function loadWebAssemblyModule(binary, loadAsync) {
if (prop.startsWith('invoke_')) {
// A missing invoke, i.e., an invoke for a function type
// 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;
+ // and the dynamic library cannot provide JS for it. Generate
+ // a closure for it.
+ var dynCallName = 'dynCall_' + prop.slice(7);
+ 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);
+ }
+ }
+ return env[prop];
}
// if not a global, then a function - call it indirectly
return env[prop] = function() {
src/main.c
View file @
fe16f98a
...
...
@@ -10,32 +10,6 @@
#include "python2js.h"
#include "runpython.h"
/*
TODO: This is a workaround for a weird emscripten compiler bug. The
matplotlib/_qhull.so extension makes function pointer calls with these
signatures, but since nothing with that signature exists in the MAIN_MODULE,
it can't link the SIDE_MODULE. Creating these dummy functions here seems to
work around the problem.
*/
void
__foo
(
double
x
)
{}
void
__foo2
(
double
x
,
double
y
)
{}
void
__foo3
(
double
x
,
double
y
,
double
z
)
{}
void
__foo4
(
int
a
,
double
b
,
int
c
,
int
d
,
int
e
)
{}
/* END WORKAROUND */
int
main
(
int
argc
,
char
**
argv
)
{
...
...
test/test_scipy.py
0 → 100644
View file @
fe16f98a
def
test_brentq
(
selenium_standalone
):
selenium_standalone
.
load_package
(
"scipy"
)
selenium_standalone
.
run
(
"from scipy.optimize import brentq"
)
selenium_standalone
.
run
(
"brentq(lambda x: x, -1, 1)"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment