D2 port of Sociomantic CDGC available for early experiments

Walter Bright via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Oct 9 01:18:25 PDT 2014


On 10/8/2014 11:43 PM, Rainer Schuetze wrote:
> 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.

Define a global variable in druntime in its own module:

     __gshared int druntime_flags = 0;

Then, in your app, override it:

     __gshared int druntime_flags = values...;


More information about the Digitalmars-d-announce mailing list