www.digitalmars.com         C & C++   DMDScript  

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

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 puremagic.com
          Reporter: chatelet.guillaume 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()
{
...
}

}

--
Feb 17 2015