char ***argc problems.

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Aug 12 14:02:43 PDT 2012


On 8/12/12, Simen Kjaeraas <simen.kjaras at gmail.com> wrote:
>      // Array of pointers to command line parameters.
>      char*[] argv = args.map!((a)=>(a.dup~'\0').ptr).array;

You know.. it'd be much simpler if argc & argv were stored somewhere.
druntime/src/rt/dmain2.d is where the action begins:

extern (C) int main(int argc, char** argv) { ... }

And then this is stored as a string[] to _d_args which can be picked
up via Runtime.args() in core.runtime.

I'm thinking that having to retrieve the original argc/argv is common
when interfacing with C/C++, so maybe we should have a druntime
function which can return the original unprocessed args?


More information about the Digitalmars-d-learn mailing list