On Fri, 25 Nov 2011 15:55:15 +0100, Max Samukha <max...@spambox.com> wrote:

On 11/25/2011 02:27 PM, Andrei Alexandrescu wrote:
On 11/25/11 2:13 AM, Jude Young wrote:
Is there an easy way to turn D style (string[] args) into C style?

Hm, I expected this would work:

extern(C) int __argc;
extern(C) char** __argv;

The symbols do exist at least on OSX (no linker error) but they are both
zero, so apparently druntime doesn't initialize them.


Andrei


If you want a reference to an externally defined variable, you need another "extern" and (if the variable is non-TLS) - __gshared:

__gshared extern extern(C) int __argc;

It also took me terribly long to find out that one for getting environ.
We could probably get rid of setErrno and getErrno which add extra C sources
to druntime.






Reply via email to