Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 committed May 13, 2019
1 parent 07c24cb commit a57cb34
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -2152,32 +2152,34 @@ LibraryManager.library = {
}

var lib = LDSO.loadedLibs[handle];
var is_main_module = lib.module == Module;
var isMainModule = lib.module == Module;

var mangled = '_' + symbol;
var mod_symbol = mangled;
var modSymbol = mangled;
#if WASM_BACKEND
if (!is_main_module) {
mod_symbol = symbol;
if (!isMainModule) {
modSymbol = symbol;
}
var asm_symbol = symbol;
#else
var asm_symbol = mangled;
#endif

if (!lib.module.hasOwnProperty(mod_symbol)) {
DLFCN.errorMsg = ('Tried to lookup unknown symbol "' + mod_symbol +
if (!lib.module.hasOwnProperty(modSymbol)) {
DLFCN.errorMsg = ('Tried to lookup unknown symbol "' + modSymbol +
'" in dynamic lib: ' + lib.name);
return 0;
}

var result = lib.module[mod_symbol];
var result = lib.module[modSymbol];
#if WASM
// Attempt to get the real "unwrapped" symbol so we have more chance of
// getting wasm function which can be added to a table.
if (is_main_module) {
if (lib.module["asm"][asm_symbol]) {
result = lib.module["asm"][asm_symbol];
if (isMainModule) {
#if WASM_BACKEND
var asmSymbol = symbol;
#else
var asmSymbol = mangled;
#endif
if (lib.module["asm"][asmSymbol]) {
result = lib.module["asm"][asmSymbol];
}
}
#endif
Expand Down

0 comments on commit a57cb34

Please sign in to comment.