Skip to content

Don't emit code to call main if there is no main #5850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 28, 2017

Conversation

kripken
Copy link
Member

@kripken kripken commented Nov 26, 2017

No description provided.

@curiousdannii
Copy link
Contributor

curiousdannii commented Nov 26, 2017

You should be able to put these lines behind #if HAS_MAIN too:

https://github.com/kripken/emscripten/blob/137382c98097eee658285b7a25dc8470fa55f332/src/postamble.js#L389-L396

@saschanaz
Copy link
Collaborator

(That jsifier.js looks very Python-ish, I incorrectly thought they are even invalid 😮)

@@ -163,6 +163,7 @@ dependenciesFulfilled = function runCaller() {
if (!Module['calledRun']) dependenciesFulfilled = runCaller; // try this again later, after new deps are fulfilled
}

#if HAS_MAIN
Module['callMain'] = Module.callMain = function callMain(args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Module['callMain'] and Module.callMain are same in JS, can we remove the latter part?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm actually not sure why we have this pattern. I suspect it is very old, and either worked around a closure compiler bug or a bug in our understanding of closure compiler ;) We should remove it across the codebase, leaving only Module['X'].

@kripken
Copy link
Member Author

kripken commented Nov 26, 2017

Thanks @curiousdannii , adding.

@kripken kripken merged commit c56eb77 into incoming Nov 28, 2017
@kripken kripken deleted the no-callMain-without-main branch November 28, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants