This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 10711 - shared phobos library should not depend on _Dmain
- Loading branch information
1 parent
f76bc34
commit 5373575
Showing
4 changed files
with
65 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* Contains druntime entry point for console programs. | ||
* | ||
* Copyright: Copyright Digital Mars 2000 - 2013. | ||
* License: Distributed under the | ||
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). | ||
* (See accompanying file LICENSE) | ||
* Authors: Walter Bright, Sean Kelly | ||
* Source: $(DRUNTIMESRC src/rt/_entrypoint.d) | ||
*/ | ||
|
||
module rt.entrypoint; | ||
|
||
alias extern(C) int function(char[][] args) MainFunc; | ||
|
||
extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc); | ||
|
||
|
||
/*********************************** | ||
* The D main() function supplied by the user's program | ||
* | ||
* It always has `_Dmain` symbol name and uses C calling convention. | ||
* But DMD frontend returns its type as `extern(D)` because of Issue @@@9028@@@. | ||
* As we need to deal with actual calling convention we have to mark it | ||
* as `extern(C)` and use its symbol name. | ||
*/ | ||
extern(C) int _Dmain(char[][] args); | ||
|
||
/*********************************** | ||
* Substitutes for the C main() function. | ||
* Just calls into d_run_main with the default main function. | ||
* Applications are free to implement their own | ||
* main function and call the _d_run_main function | ||
* themselves with any main function. | ||
*/ | ||
extern (C) int main(int argc, char **argv) | ||
{ | ||
return _d_run_main(argc, argv, &_Dmain); | ||
} | ||
|
||
version (Solaris) extern (C) int _main(int argc, char** argv) | ||
{ | ||
// This is apparently needed on Solaris because the | ||
// C tool chain seems to expect the main function | ||
// to be called _main. It needs both not just one! | ||
return main(argc, argv); | ||
} | ||
|
||
|