This fixes an upstream bug introduced in emscripten 1.38.34 that causes dlsym to always return 0 for function pointers when EMULATE_FUNCTION_POINTER_CASTS is enabled. This is a simple typo, since `mangled == "_" + symbol`. This piece of code is no longer present in upstream master, hence there is no effort to upstream the fix. This patch is tested in emsdk/tests/test_emulate.py diff --git a/emsdk/fastcomp/emscripten/src/library.js b/emsdk/fastcomp/emscripten/src/library.js index 97cca10..5c002d7 100644 --- a/emsdk/fastcomp/emscripten/src/library.js +++ b/emsdk/fastcomp/emscripten/src/library.js @@ -2194,7 +2194,7 @@ LibraryManager.library = { // can call (which does not use that ABI), as the function pointer would // not be usable from wasm. instead, the wasm has exported function pointers // for everything we need, with prefix fp$, use those - result = lib.module['fp$' + symbol]; + result = lib.module['fp$' + mangled]; if (typeof result === 'object') { // a breaking change in the wasm spec, globals are now objects // https://github.com/WebAssembly/mutable-global/issues/1