summaryrefslogtreecommitdiff
path: root/src/preamble.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/preamble.js')
-rw-r--r--src/preamble.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/preamble.js b/src/preamble.js
index 58b442ab..bba2fc46 100644
--- a/src/preamble.js
+++ b/src/preamble.js
@@ -312,10 +312,15 @@ var globalScope = this;
// Returns the C function with a specified identifier (for C++, you need to do manual name mangling)
function getCFunc(ident) {
- try {
- var func = Module['_' + ident]; // closure exported function
- if (!func) func = eval('_' + ident); // explicit lookup
- } catch(e) {
+ var func = Module['_' + ident]; // closure exported function
+ if (!func) {
+#if NO_DYNAMIC_EXECUTION == 0
+ try {
+ func = eval('_' + ident); // explicit lookup
+ } catch(e) {}
+#else
+ abort('NO_DYNAMIC_EXECUTION was set, cannot eval - ccall/cwrap are not functional');
+#endif
}
assert(func, 'Cannot call unknown function ' + ident + ' (perhaps LLVM optimizations or closure removed it?)');
return func;
@@ -458,7 +463,11 @@ var cwrap, ccall;
funcstr += JSsource['stackRestore'].body + ';';
}
funcstr += 'return ret})';
+#if NO_DYNAMIC_EXECUTION == 0
return eval(funcstr);
+#else
+ abort('NO_DYNAMIC_EXECUTION was set, cannot eval - ccall is not functional');
+#endif
};
})();
Module["cwrap"] = cwrap;