[Issue 11149] Runtime.args no longer available in static constructors.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 14 07:26:57 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11149



--- Comment #9 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-10-14 07:26:55 PDT ---
(In reply to comment #8)
> (In reply to comment #7)
> > It's not reflected since a copy is made in _d_run_main. But I guess this should
> > be documented.
> 
> The arguments are not copied.

I'm not seeing that:

-----
import core.runtime;
import std.stdio;
import std.string;

void main(char[][] args)
{
    auto c_args = Runtime.cArgs;
    printf("%s\n", c_args.argv[0]);

    c_args.argv[0] = cast(char*)("foobar\0".dup.ptr);
    printf("%s\n", c_args.argv[0]);

    writeln(args[0]);
}
-----

$ rdmd test.d
> C:\Users\ADMINI~1\AppData\Local\Temp\.rdmd\rdmd-test.d-E4AFE2A9EC3418A8D53133284F27D58A\test.exe
> foobar
> C:\Users\ADMINI~1\AppData\Local\Temp\.rdmd\rdmd-test.d-E4AFE2A9EC3418A8D53133284F27D58A\test.exe

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list