Bug 10711 – shared phobos library should not depend on _Dmain
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-24T07:16:00Z
Last change time
2013-08-15T10:40:22Z
Keywords
dll
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2013-07-24T07:16:13Z
When building shared D libraries the function _Dmain remains unresolved.
This is because a C main function is part of druntime.
To fix this we should generate the C main function in the glue layer of the compiler and only do that if a D main function is present.
This needs some refactoring in druntime first so that the function becomes reasonably simple, e.g. something along this line.
extern(C) int main(int argc, char*[] argv)
{
auto rc = rt_init(argv[0 .. argc]);
if (rc == 0)
{
runMain();
rc = rt_term();
}
return rc;
}