D2 port of Sociomantic CDGC available for early experiments

Rainer Schuetze via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Wed Oct 8 23:43:27 PDT 2014



On 09.10.2014 08:29, Jacob Carlborg wrote:
> On 08/10/14 22:47, Rainer Schuetze wrote:
>
>> C main is no longer under user control, because it is auto-generated
>> with D main. I never liked that change, we've just discovered another
>> reason.
>
> All platforms have API's to access the command line arguments passed to
> "main". On OS X that would be "_NSGetArgv" and "_NSGetArgc".
>

Yes, but the problem is not to access command line arguments, but to run 
code before the GC initialization i.e. before _d_run_main is executed.

If we can assume a C++ backend, using static initialization of a C++ 
global could work:

    static bool initGC = configureGC();

because the C++ runtime runs configureGC before calling C main. I'd 
rather like to see a solution using D, though.


More information about the Digitalmars-d-announce mailing list