March 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723



--- Comment #10 from Vladimir Panteleev <thecybershadow@gmail.com> 2013-03-15 03:04:56 EET ---
Oh, sorry, I meant for C programs. main() isn't the entry point, not on Windows at least, so there has to be some initialization code that invokes it. For D, it's in Druntime, and it uses the C main as an "entry point". On Windows the C runtime defines WinMain, which initializes and calls the C main().

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723


hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hsteoh@quickfur.ath.cx


--- Comment #11 from hsteoh@quickfur.ath.cx 2013-03-15 10:27:59 PDT ---
Can't we just make the DMD-injected empty main() a weak symbol, so that it gets overridden if main is already declared anywhere else?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723



--- Comment #12 from Walter Bright <bugzilla@digitalmars.com> 2013-03-15 13:57:22 PDT ---
You guyz make a good case. I amend my proposal so this should happen only when a "-main" switch is thrown on the command line.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723


jens.k.mueller@gmx.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jens.k.mueller@gmx.de


--- Comment #13 from jens.k.mueller@gmx.de 2013-03-15 15:09:46 PDT ---
Why is rdmd --main not good enough? I find this enhancement adds very little value.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723



--- Comment #14 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-15 15:14:22 PDT ---
(In reply to comment #12)
> You guyz make a good case. I amend my proposal so this should happen only when a "-main" switch is thrown on the command line.

Ok good. One other question: If another main() is found while -main is used,
should the compiler error or just avoid generating main() on its own?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723



--- Comment #15 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-15 16:52:19 PDT ---
(In reply to comment #14)
> (In reply to comment #12)
> > You guyz make a good case. I amend my proposal so this should happen only when a "-main" switch is thrown on the command line.
> 
> Ok good. One other question: If another main() is found while -main is used,
> should the compiler error or just avoid generating main() on its own?

Disregard this question, there's already a check in DMD for multiple main functions, it will be very useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #16 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-15 17:53:21 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1751

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pull                        |
         AssignedTo|andrej.mitrovich@gmail.com  |nobody@puremagic.com


--- Comment #17 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-15 21:28:21 PDT ---
I'll let someone else work on this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723



--- Comment #18 from Walter Bright <bugzilla@digitalmars.com> 2013-03-16 00:55:55 PDT ---
https://github.com/D-Programming-Language/dmd/pull/1753

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 16, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9723



--- Comment #19 from github-bugzilla@puremagic.com 2013-03-16 15:18:11 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1eb44f54ac12ff747ab447be06e1fe430ffe77a9 fix Issue 9723 - add missing main() when compiling exe with -unittest

https://github.com/D-Programming-Language/dmd/commit/a8fd11928e436d63936542576527759b488b3f4f Merge pull request #1753 from WalterBright/fix9723

fix Issue 9723 - add missing main() when compiling exe with -unittest

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------