[D-runtime] What is the point of _d_run_main() in druntime/src/rt/dmain2.d?

Walter Bright walter at digitalmars.com
Sun Aug 11 15:06:07 PDT 2013


On 8/11/2013 2:50 PM, Jonathan M Davis wrote:
> On Sunday, August 11, 2013 22:23:12 Iain Buclaw wrote:
>> 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/278968f5029f0cc9
>>> 137a0d21c641d64604674be2
>> 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...
> Isn't that what the the guys doing Win32 GUI stuff with D have been doing? At
> least, I recall them having to use C's main and then do call various things in
> druntime to initialize it so that they could use their D code properly.
> Unfortunately, I don't remember any of the details though.
>

Barring better information, I'll leave it in.


More information about the D-runtime mailing list