extern(C++, ns)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 18 00:45:40 PST 2016


On 1/17/2016 9:32 PM, Manu via Digitalmars-d wrote:
> void f()
> {
>    j = 0; // works as expected
>    k = 0; // fail
> }
> private:
> __gshared int j;
> extern(C++, ns) __gshared int k;
>
>> Error: module x variable x.ns.k is private

   https://issues.dlang.org/show_bug.cgi?id=15578

This is not a forward reference bug, it happens even if 'k' is declared before 
'f()'.

The workaround is simple: either comment out the 'private' or add 'public' in 
front of the declaration of 'k'.


More information about the Digitalmars-d mailing list