[Issue 14193] New: Provide a way to mangle a D struct as a C++ class.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Feb 17 04:19:09 PST 2015


https://issues.dlang.org/show_bug.cgi?id=14193

          Issue ID: 14193
           Summary: Provide a way to mangle a D struct as a C++ class.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: chatelet.guillaume at gmail.com

It seems better to implement C++ types as structs in D because of value
semantic and easier integration.

Unfortunately, Microsoft's compiler mangles structs and classes in a different
way so using a struct on D side will fail to link with the C++ object.

See http://en.wikipedia.org/wiki/Visual_C%2B%2B_name_mangling#Data_Type.

Maybe we could define something like the following :

extern(C++, std) {

pragma(mangleAs, "class") struct basic_string()
{
...
}

}

--


More information about the Digitalmars-d-bugs mailing list