summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc_to_wasm.js.sh2
-rw-r--r--src/wasm-js.cpp7
2 files changed, 5 insertions, 4 deletions
diff --git a/emcc_to_wasm.js.sh b/emcc_to_wasm.js.sh
index 2f68b55c3..5e89f198e 100755
--- a/emcc_to_wasm.js.sh
+++ b/emcc_to_wasm.js.sh
@@ -3,7 +3,7 @@
set -e
echo "calling emcc"
-emcc -o a.html --separate-asm -profiling -s TOTAL_MEMORY=67108864 -s GLOBAL_BASE=1024 -s ALIASING_FUNCTION_POINTERS=0 $@
+emcc -o a.html --separate-asm -g1 -s TOTAL_MEMORY=67108864 -s GLOBAL_BASE=1024 -s ALIASING_FUNCTION_POINTERS=0 $@
# we now have a.asm.js and a.js
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index b26a5b4d6..a65eedd0f 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -209,8 +209,9 @@ extern "C" double EMSCRIPTEN_KEEPALIVE call_from_js(const char *target) {
#ifdef WASM_JS_DEBUG
std::cout << "call_from_js " << target << '\n';
#endif
- IString name(target);
- Function *function = instance->wasm.functionsMap[name];
+ IString exportName(target);
+ IString functionName = instance->wasm.exportsMap[exportName]->value;
+ Function *function = instance->wasm.functionsMap[functionName];
assert(function);
size_t seen = EM_ASM_INT_V({ return Module['tempArguments'].length });
size_t actual = function->params.size();
@@ -228,7 +229,7 @@ extern "C" double EMSCRIPTEN_KEEPALIVE call_from_js(const char *target) {
abort();
}
}
- Literal ret = instance->callExport(name, arguments);
+ Literal ret = instance->callExport(exportName, arguments);
#ifdef WASM_JS_DEBUG
std::cout << "call_from_js returning " << ret << '\n';
#endif