Specifying C++ symbols in C++ namespaces

Walter Bright newshound2 at digitalmars.com
Wed Apr 2 15:07:03 PDT 2014


Here's Andrei's proposal:

     extern (C++) template nspace() {
         int foo();
     }

It would be accessed in D by:

    nspace!().foo();

A possible enhancement would be to allow (for all templates with no parameters):

     nspace.foo();

Note that:

     template nspace() {
         extern (C++) int foo();
     }

would not put foo() in a C++ namespace, although it would still be accessed from 
D as:

     nspace.foo();

One downside of this proposal is that if we ever (perish the thought!) attempted 
to interface to C++ templates, this design would preclude that.


More information about the Digitalmars-d mailing list