diff options
Diffstat (limited to 'src/preamble.js')
-rw-r--r-- | src/preamble.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/preamble.js b/src/preamble.js index 07ddf7ea..8a42243a 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -168,6 +168,16 @@ function __initializeRuntime__() { STATICTOP = alignMemoryPage(STACK_MAX); } +function __shutdownRuntime__() { + while( __ATEXIT__.length > 0) { + var func = __ATEXIT__.pop(); + if (typeof func === 'number') { + func = FUNCTION_TABLE[func]; + } + func(); + } +} + // stdio.h // C-style: we work on ints on the HEAP. |