Skip to content

Commit

Permalink
for emscripten - main needs a different mangle with the args there
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdruppe committed Oct 24, 2024
1 parent 635f54d commit 7ae80d5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions druntime/src/core/internal/entrypoint.d
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ template _d_cmain()

int _Dmain(char[][] args);

int main(int argc, char **argv)
{
return _d_run_main(argc, argv, &_Dmain);
version (Emscripten)
{
pragma(mangle, "__main_argc_argv")
export int main(int argc, char **argv)
{
return _d_run_main(argc, argv, &_Dmain);
}
}
else
{
int main(int argc, char **argv)
{
return _d_run_main(argc, argv, &_Dmain);
}
}

// Solaris, for unknown reasons, requires both a main() and an _main()
Expand Down

0 comments on commit 7ae80d5

Please sign in to comment.