Specifying C++ symbols in C++ namespaces

deadalnix deadalnix at gmail.com
Thu Apr 3 17:47:48 PDT 2014


On Wednesday, 2 April 2014 at 22:06:53 UTC, Walter Bright wrote:
> 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.

I'm not familiar with usual C++ mangling as much as D. Are
template and namespace mangled the same way ?


More information about the Digitalmars-d mailing list