extern(C++, NS)

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 30 09:44:34 PST 2015


On 11/30/2015 3:42 AM, Manu via Digitalmars-d wrote:
> That's not how it seems to be,

Are you still not understanding how name lookup works in D?

(You won't be the first. I explain it to people over and over, and nobody gets 
it. I have no idea why it is so hard to understand.)

C++ namespaces introduce scopes. The normal D lookup rules for scoped names 
applies. When names in C++ namespaces are mangled, they are mangled like C++ 
names would be, not like D names would be.

Lookup rules, apply one by one until found:

1. Look up in current scope.
2. Look up in imported scopes. Error if more than one is found.
3. Go up a level, and goto 1.


More information about the Digitalmars-d mailing list