Thread overview
[D-runtime] What is the point of _d_run_main() in druntime/src/rt/dmain2.d?
Aug 09, 2013
Walter Bright
Aug 11, 2013
Jacob Carlborg
Aug 11, 2013
Iain Buclaw
Aug 11, 2013
Jonathan M Davis
Aug 11, 2013
Walter Bright
August 09, 2013
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?
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

August 11, 2013
On 10 aug 2013, at 00:04, Walter Bright <walter@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

-- 
/Jacob Carlborg

_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

August 11, 2013
On 11 August 2013 20:40, Jacob Carlborg <doob@me.com> wrote:
>
> On 10 aug 2013, at 00:04, Walter Bright <walter@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';
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

August 11, 2013
On Sunday, August 11, 2013 22:23:12 Iain Buclaw wrote:
> On 11 August 2013 20:40, Jacob Carlborg <doob@me.com> wrote:
> > On 10 aug 2013, at 00:04, Walter Bright <walter@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.

- Jonathan M Davis
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime

August 11, 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@me.com> wrote:
>>> On 10 aug 2013, at 00:04, Walter Bright <walter@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.
_______________________________________________
D-runtime mailing list
D-runtime@puremagic.com
http://lists.puremagic.com/mailman/listinfo/d-runtime