Skip to content

Commit

Permalink
refactor calling of _main()
Browse files Browse the repository at this point in the history
  • Loading branch information
azakai committed Mar 6, 2011
1 parent 7d2f754 commit 6db5de7
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/postamble.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@

// === Auto-generated postamble setup entry stuff ===

function run(args) {
__initializeRuntime__();

var globalFuncs = [];

{{GLOBAL_VARS}}

function callMain(args) {
var argc = args.length+1;
function pad() {
for (var i = 0; i < QUANTUM_SIZE-1; i++) {
Expand All @@ -23,10 +17,21 @@ function run(args) {
argv.push(0);
argv = Pointer_make(argv, null);

Module._main(argc, argv, 0);
}
Module['callMain'] = callMain;

function run(args) {
__initializeRuntime__();

var globalFuncs = [];

{{GLOBAL_VARS}}

__globalConstructor__();

if (Module['_main']) {
_main(argc, argv, 0);
Module.callMain(args);
__shutdownRuntime__();
}
}
Expand Down

0 comments on commit 6db5de7

Please sign in to comment.