Why do we have Dmain?

user1234 user1234 at 12.de
Mon Oct 25 07:49:44 UTC 2021


On Friday, 22 October 2021 at 05:54:21 UTC, Kirill wrote:
> I am not a compiler expert, but I genuinely would like to know 
> why we have Dmain.
>
> I've been looking at the generated assembly code recently and 
> noticed the _Dmain function. I didn't notice it before. Then 
> there is main, where Dmain is called.
>
> Why is that?

in addition to the other answers, there's also the parameters of 
main:

     int argc, char** argv

becomes

     string[]

so with the D main you're directly in the the D "domain". In 
theory from that point, you don't need to ever use `strlen` for 
example.


More information about the Digitalmars-d-learn mailing list