C++ template name mangling

Tofu Ninja via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 15 19:23:44 PDT 2014


On Friday, 15 August 2014 at 19:53:28 UTC, Walter Bright wrote:
> Currently, D supports:
>
> 1. C++ function name mangling
> 2. C++ namespace name mangling
> 3. C++ class field and vtbl[] layout
> 4. C++ function calling conventions
>
> But what is missing is name mangling to match C++ templates. 
> This makes it awkward and tedious to construct a D interface to 
> a C++ template.
>
> Andrei has proposed that D support, for templates declared 
> within an extern(C++) block, C++ name mangling. This should not 
> be difficult, it should not break any existing D source code, 
> and will enable limited interaction with C++ templates from D.
>
> One nice side benefit is that no other language offers such 
> support, and given the increasing ubiquity of C++ template use, 
> it would give us a nice leg up.

Would this only be usable be usable for templates already
instantiated in the c++ object file you were linking with?


More information about the Digitalmars-d mailing list