On 09.10.2014 10:18, Walter Bright wrote:
On 10/8/2014 11:43 PM, Rainer Schuetze wrote:
Yes, but the problem is not to access command line arguments, but to
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++
static bool initGC = configureGC();
because the C++ runtime runs configureGC before calling C main. I'd
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...;
That's similar to my approach to replace gc.config by a different module
with the same module name when compiling the executable:
dmd main.d my_gc_config.d
where my_gc_config.d contains "module gc.config;" and thus replaces the
module in the library.
Martin is very much against this, one reason is that it does not work
with druntime in a shared library.