"Guillaume Chatelet" wrote in message news:[email protected]...

I did a few tests. Using a class doesn't work because of the added vptr.

This is a bug, D currently adds a vptr even if there are no members. It's just one that doesn't happen to affect ddmd so I never got around to fixing it.

struct std_string {
void[8] _ = void; // to match sizeof(std::string) and pad the object correctly.
}

The padding will be left untouched on the D side because of void initializer and will be managed entirely on the C++ side.

Just remember to be careful that any C++ structs don't rely on interior pointers.

- name mangling on linux (bug reported in my first message)

Is this in bugzilla?

- name mangling on Windows at least (name would be mangled as a struct instead of class)

We can probably use pragma(mangle) to fix this or add a new pragma for it. eg pragma(cpp_class/cpp_struct);

- disabled default constructor.

Yeeeeah I've always felt like we're going to have to add default struct ctors to D eventually.

Reply via email to