[Issue 20082] Struct with extern destructor that's never called causes link error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 26 05:16:38 UTC 2019


--- Comment #8 from Rainer Schuetze <r.sagitario at gmx.de> ---
> What's the workaround?

If you can assume that the dtor is supplied as soon as you actually use the
struct, this could work on Windows:

struct S

void dummyDtor()
    // dtor not linked in!

pragma(linkerDirective, "/ALTERNATENAME:" ~ S.__dtor.mangleof ~ "=" ~

IIRC there is some other way on Posix to get weak linkage.


More information about the Digitalmars-d-bugs mailing list