[Issue 22323] Link error for virtual destructor of C++ class in DLL

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 20 03:24:30 UTC 2021


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

kinke <kinke at gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke at gmx.net

--- Comment #1 from kinke <kinke at gmx.net> ---
(In reply to Tim from comment #0)
> It works using static linking.

Then it looks like the MS compiler generates the symbol but doesn't export it
even when exporting the class - or at least doesn't include the forwarder in
the DLL import lib.

It looks like this might be solvable by removing the condition in
https://github.com/dlang/dmd/blob/0bbb30aad9a782b4e9a1cbec62704240729d7864/src/dmd/clone.d#L1069,
where the D compiler only defines it in case the regular destructor is defined
in D as well. The symbol would most likely need to be emitted as a weak
definition though to prevent conflicts when linking statically etc.

--


More information about the Digitalmars-d-bugs mailing list