Thread overview
[Issue 22323] Link error for virtual destructor of C++ class in DLL
Sep 19, 2021
Tim
Sep 20, 2021
kinke
Sep 21, 2021
Tim
Oct 10, 2021
Dlang Bot
Oct 12, 2021
Dlang Bot
Oct 12, 2021
Dlang Bot
Oct 13, 2021
Dlang Bot
September 19, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

Tim <tim.dlang@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |C++

--
September 20, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

kinke <kinke@gmx.net> changed:

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

--- Comment #1 from kinke <kinke@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.

--
September 21, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

--- Comment #2 from Tim <tim.dlang@t-online.de> ---
(In reply to kinke from comment #1)
> 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.

Thanks for the suggestion. It seems to work in a first test.

--
October 10, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
@tim-dlang created dlang/dmd pull request #13148 "fix Issue 22323: Link error for virtual destructor of C++ class in DLL" fixing this issue:

- fix Issue 22323: Link error for virtual destructor of C++ class in DLL

  The new test test/dshell/dll_cxx.d is based on test/dshell/dll.d, but
  builds the DLL/SO from C++ instead of D.

https://github.com/dlang/dmd/pull/13148

--
October 12, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13148 "fix Issue 22323: Link error for virtual destructor of C++ class in DLL" was merged into master:

- d71fd29d62bf404e887740274ee6c98e56c7bd6f by Tim Schendekehl:
  fix Issue 22323: Link error for virtual destructor of C++ class in DLL

  The new test test/dshell/dll_cxx.d is based on test/dshell/dll.d, but
  builds the DLL/SO from C++ instead of D.

https://github.com/dlang/dmd/pull/13148

--
October 12, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13160 "fix Issue 22323: Link error for virtual destructor of C++ class in DLL" was merged into stable:

- 062a2f27565b8e3dabde457757742ebc3c9af8c6 by Tim Schendekehl:
  fix Issue 22323: Link error for virtual destructor of C++ class in DLL

  The new test test/dshell/dll_cxx.d is based on test/dshell/dll.d, but
  builds the DLL/SO from C++ instead of D.

https://github.com/dlang/dmd/pull/13160

--
October 13, 2021
https://issues.dlang.org/show_bug.cgi?id=22323

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #13164 "Merge stable" was merged into master:

- 1e6217535f271fe9e6911bc1bf113df1a345a589 by Tim Schendekehl:
  fix Issue 22323: Link error for virtual destructor of C++ class in DLL

  The new test test/dshell/dll_cxx.d is based on test/dshell/dll.d, but
  builds the DLL/SO from C++ instead of D.

https://github.com/dlang/dmd/pull/13164

--