On Sunday, 5 January 2014 at 18:22:54 UTC, Mineko wrote:
I keep getting mixed results searching for this. :\
Just as the title says, is it safe to extern (C) variables?
Something like this:
extern (C) auto foo = 800;
And then call that from another program?
Also, just because this has been bugging me for a while.. Is
export broken, or it it not supposed to be used the same way as
extern (C)?
I wouldn't do it that way. I would use extern(C) with struct and
function definitions/declarations, but I don't think it makes
sense to use it with individual variables.
Not sure if anything is wrong with export, but they are two
different things. Export allows something to be visible to other
programs(like in a shared library) and extern is(I believe) more
so for specifying how something outside the program is meant to
be linked in.