extern(C++, ns)

Carl Sturtivant via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 7 09:03:41 PST 2016


On Thursday, 7 January 2016 at 14:15:03 UTC, Jacob Carlborg wrote:
> On 2016-01-07 15:03, Marc Schütz wrote:
>
>> But there remains the issue of using D keywords in C++ 
>> namespaces. Maybe
>> there could be a variant `extern(C++, "ns1.ns2.as.string")`, 
>> that
>> doesn't create symbols and affects mangling only?
>
> It looks like extern(C++, ns) creates a symbol in the D code. 
> If that's the case, then it should be possible, in theory, to 
> attach pragma(mangle) to that symbol.
>
> pragma(mangle, "try") extern(C++, try_)
> {
>     void foo();
> }

Exactly: makes perfect sense, and deals with the problem 
uniformly as with other languages.




More information about the Digitalmars-d mailing list