Signature of main [was Sockets between D and C(++) app]
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Apr 2 04:59:16 PDT 2014
On 4/2/14, Dicebot <public at dicebot.lv> wrote:
> D main != C main, latter is implemented in D runtime to call the
> former. 0 will be also returned by latter, not the former.
Actually, the compiler injects a return statement in D's main.
It generates the actual C main function (unless WinMain/DllMain is
provided), which calls another special D runtime init function, which
itself calls the D main function (which itself has the injected return
statement unless it's already an int return).
It's quite complicated, but it's all open-source so you can inspect it.
More information about the Digitalmars-d-learn
mailing list