diff options
Diffstat (limited to 'src/preamble_sharedlib.js')
-rw-r--r-- | src/preamble_sharedlib.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/preamble_sharedlib.js b/src/preamble_sharedlib.js index 4b91c44c..2a071f6b 100644 --- a/src/preamble_sharedlib.js +++ b/src/preamble_sharedlib.js @@ -4,7 +4,21 @@ // Runtime essentials //======================================== -var __globalConstructor__ = function globalConstructor() { +function callRuntimeCallbacks(callbacks) { + while(callbacks.length > 0) { + var callback = callbacks.pop(); + var func = callback.func; + if (typeof func === 'number') { + func = FUNCTION_TABLE[func]; + } + func(callback.arg === undefined ? null : callback.arg); + } +} + +var __ATINIT__ = []; // functions called during startup + +function initRuntime() { + callRuntimeCallbacks(__ATINIT__); } // === Body === |