[Issue 15579] extern(C++) interfaces/multiple-inheritance

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jan 22 20:47:03 PST 2016


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

--- Comment #7 from Manu <turkeyman at gmail.com> ---
I was just doing some work with the latest nightly (should have this patch in
it).
I got a compile error that's new since the last nightly I was using:

3>Building bin\Debug_x64\dplug.dll...
3>libdep.lib(component_344_d5.obj) : fatal error LNK1179: invalid or corrupt
file: duplicate COMDAT '??1Component at ep@@QEAA at XZ'

The project structure is:
  cpplib.lib --+
  dlib.lib ----|
               |
           dplug.dll

So, cpplib has the stuff I'm extern-ing to, dlib is a binding to cpplib with
some adaptation support code, and dplug is a dll which links both libs.
dlib is mostly extern(C++)'s, and a bunch of extra (mostly extern(D)) code for
adaptation.
I presume that symbol exists in cpplib, but the error suggests that D is also
emitting the same symbol somewhere?


Possibly uninteresting, but I have a lot of code like this:

extern(C++) class CppClass
{
  void cppMethod(ref const(CustomString) &s);
  void cppMethod2();

extern(D):
  void dAdapterMethod(const(char)[] s) { auto temp = CustomString(s.ptr,
s.length); cppMethod(temp); }
}

This is a simple example, but there's a lot of this going on... so the
extern(C++) classes are kitted out with a bunch of extra functions on the D
side.
I only say this, because I wonder if the fact that I'm not strictly binding,
but also extending may lead to symbols being emitted...

--


More information about the Digitalmars-d-bugs mailing list