What happens when you launch a D application ?
Suliman via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu May 21 23:36:26 PDT 2015
On SO[1] I got next answer:
"What happens when you launch a D application ? The entry point
is a C main inside the runtime, which initialize it (the
runtime), including module constructor, run the unittest (if
you've compiled with -unittest), then call your main (which name
is "_Dmain" - useful to know if you want to set a breakpoint with
GDB). When Vibe.d's main is called, it parses command line
argument, an optional config file, and finally, starts the event
loop. Any code that wish to run once the event loop has started
should use runTask and similar, or createTimer. They should not
call the code directly from the static constructor (it's actually
one of the most common mistake when starting with Vibe.d)."
Could you explain what mean "C main inside the runtime". I
thought that is only one main is possible. And why it's named
"*ะก* main" D is not C-translated language.
Same question is about _Dmain -- what is it?
If I will call this() before main? What it will be? Will it run
before main?
[1]
http://stackoverflow.com/questions/30302161/cant-connect-to-mysql-mariadb-database-from-vibed-app
More information about the Digitalmars-d-learn
mailing list