Hi

Thank you very much for looking at this!

I can't speak to what other effects this might have, but it would
definitely solve our problem.

So +1 from me.

Regards,
Cory


On Sat, Apr 30, 2022, 02:23 LIU Hao <[email protected]> wrote:

> 在 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
>

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to