C++ template name mangling
Idan Arye via Digitalmars-d
digitalmars-d at puremagic.com
Fri Aug 15 19:18:35 PDT 2014
On Saturday, 16 August 2014 at 01:55:44 UTC, Andrei Alexandrescu
wrote:
> The state/layout must be duplicated. The D compiler would
> generate proper mangled calls and even (in the future) proper
> constructor and destructor calls, which would take us to the
> holy grail - seamless C++ object manipulation from D. From the
> C++ side this is needed:
>
> template class basic_string<char>;
>
> That instructs the C++ compiler to make all methods of that
> instantiation available for linking. Then D would simply
> compile calls to them, achieving parity save for inlining.
> Inlining is important so probably in stage 3 we should allow
> inlining on the D side as well.
>
>
> Andrei
Wouldn't that mean that the you'll need to make a .cpp file with
all the template instantiations used by the D code and compile it
with a C++ compiler?
dmd can't do all that automatically for you, since it does not
contain a C++ compiler, but maybe it can be ran with the `-c`
flag to disable linking, produce that .cpp file, and the build
system will be responsible for compiling that file and linking it
together with the rest of the project?
More information about the Digitalmars-d
mailing list