在 2022-04-30 01:41, [email protected] 写道:
By defining WINPTHREADS_STATIC, the downstream's dll exports will (correctly) not be affected by pthreads. Signed-off-by: Cory Fields <[email protected]> --- mingw-w64-libraries/winpthreads/include/pthread.h | 2 +- mingw-w64-libraries/winpthreads/include/sched.h | 2 +- mingw-w64-libraries/winpthreads/include/semaphore.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Hmm I understand the problem, but I'm not sure whether it is the correct solution.The purpose of `DLL_EXPORT` is to allow conditional `__declspec(dllexport)` when building a DLL. As you have pointed out, libtool defines it when building a shared library; and it *should* only have an effect when building a shared library i.e. checking for it in public headers is almost always an error.
OTOH `__declspec(dllimport)` is largely unnecessary because of `--enable-auto-import` [1] which is on by default.
Hence I propose the following solution: ``` #if defined(DLL_EXPORT) && defined(IN_WINPTHREAD) # define WINPTHREAD_API __declspec(dllexport) /* building the winpthread DLL */ #else # define WINPTHREAD_API /* building the static library, or other applications */ #endif ``` [1] https://sourceware.org/binutils/docs-2.38/ld/Options.html#Options-Specific-to-i386-PE-Targets -- Best regards, LIU Hao
OpenPGP_signature
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
