Specifying C++ symbols in C++ namespaces

Dicebot public at dicebot.lv
Fri Apr 4 15:17:44 PDT 2014


On Friday, 4 April 2014 at 19:33:34 UTC, Simen Kjærås wrote:
> I'm not entirely sure I follow you here. Is this what you mean?
>
> extern(C++) module nspace {
>     int foo();
> }
>
> void main() {
>     foo();        // Either this does not work, (#1)
>     nspace.foo(); // or this does not work.     (#2)
> }
>
> If so, is that really bad? I'd say the better choice is to make 
> #2 work, as then #1 can be made to work with a simple alias:
>
> alias foo = nspace.foo;
>
> If I'm far off into the fields of ignorance now, care to show 
> me the way to a better understanding?

#2 should not compile. D currently does not have any notion of 
namespaces other than modules / aggregates and I am against 
introducing those just for the sake of interfacing with C++.


More information about the Digitalmars-d mailing list