C++ header generation: Mixin template to create C ABI from D class fails due to pragma(mangle) seeming not to work?

Adam D Ruppe destructionator at gmail.com
Sun Nov 7 19:46:45 UTC 2021


On Sunday, 7 November 2021 at 19:25:43 UTC, Gavin Ray wrote:
> pragma(mangle, "create_" ~ __traits(identifier, Type))
> void* creator(Parameters!(Type.__ctor) args) {}

That would create a function with the literal mangle

create_TYPENAMEHERE

which isn't C++ compatible.

If you had an `extern "C" whatever 
create_TYPENAMEHERE(whateveR);` then that mangle would tie in.

You might just want to use an extern(C++) constructor here..


More information about the Digitalmars-d mailing list