Subject: bug#41152: DLL_EXPORT in libtool.m4

From: Malcolm MacLeod <[email-masked]>
Date: Sat, 09 May 2020 09:12:36 +0200

When building a shared library (dll) on windows (msys2; but also other environments) using libtool,
libtool.m4 defines -DDLL_EXPORT - which is mentioned in libtool.m4 as being a 'hack'.

In a normal situation this doesn't have an obvious ill effect, but if you are attempting to build a
dll whose linkage to all other libraries (e.g. pthread) is static (as is sometimes desirable if e.g.
building a plugin) this results in all object files being contaminated with symbols for dynamic
pthread which then fail at link time, because of course pthread is only statically linked.

I believe this hack does more harm than good and should be removed, it is common practice on windows
that if you want exports/imports you should request them by setting the define yourself, so I don't
see why libtool attempts to automatically set this.
Should it not be possible to remove the hack, there should at least be some way to turn it off,
currently I have to now "#undef DLL_EXPORT" all over my codebase which is messy and undesirable.

Regards,
Malcolm MacLeod