mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 07:12:15 +00:00
[WebAssembly] Add call to __wasm_call_ctors on startup if found (#42)
This commit is contained in:
parent
ac877172c1
commit
c93b284f39
@ -1475,10 +1475,12 @@ var main_module = arguments[0];
|
|||||||
modules[0] = load_wasm(main_module);
|
modules[0] = load_wasm(main_module);
|
||||||
heap_end = modules[0].exports.__heap_base;
|
heap_end = modules[0].exports.__heap_base;
|
||||||
|
|
||||||
if (!(modules[i].exports.main instanceof Function))
|
if (!(modules[0].exports.main instanceof Function))
|
||||||
throw new Error('main() not found');
|
throw new Error('main() not found');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (modules[0].exports.__wasm_call_ctors instanceof Function)
|
||||||
|
modules[0].exports.__wasm_call_ctors();
|
||||||
var ret = modules[0].exports.main();
|
var ret = modules[0].exports.main();
|
||||||
stdio.__flush_stdout();
|
stdio.__flush_stdout();
|
||||||
print(main_module + '::main() returned ' + ret);
|
print(main_module + '::main() returned ' + ret);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user