[D-runtime] What is the point of _d_run_main() in druntime/src/rt/dmain2.d?
Iain Buclaw
ibuclaw at ubuntu.com
Sun Aug 11 14:23:12 PDT 2013
On 11 August 2013 20:40, Jacob Carlborg <doob at me.com> wrote:
>
> On 10 aug 2013, at 00:04, Walter Bright <walter at digitalmars.com> wrote:
>
>> I cannot see any use for it, though there was obviously one in mind when it was created. Does anyone remember? Does anyone use it?
>
>
> I guess it's so you can implement your own C main function and call "_d_run_main" from it. This is also what the comments say. GDC, and possibly LDC, used this approach long before DMD, perhaps a change to unify the different runtimes. Here's the commit that introduced it, if it helps:
>
> https://github.com/D-Programming-Language/druntime/commit/278968f5029f0cc9137a0d21c641d64604674be2
>
Originally for gdc, C main was in it's own module. The idea being
that should druntime be built as a shared library, C main would not be
included in it. This was to allow other languages which have their
own C main to link again druntime/phobos.
I'm not sure if allowing other languages to link against druntime is a
goal anymore...
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';
More information about the D-runtime
mailing list