在 2025-6-6 17:41, Kirill Makurin 写道:
From 8c131c07c784799b56a889b0c25396e0c0ddb9e8 Mon Sep 17 00:00:00 2001
From: Kirill Makurin <maiddais...@outlook.com>
Date: Fri, 6 Jun 2025 18:26:24 +0900
Subject: [PATCH] winpthreads: do not expose IN_WINPTHREAD in public header
 files

When building winpthreads, define WINPTHREAD_API in config.h
instead of public pthread_compat.h.

Definition of WINPTHREAD_API in pthread_compat.h will only be used
by client code.

Note that IN_WINPTHREAD is still defined.
It is checked for in mingw-w64's time.h.

Signed-off-by: Kirill Makurin <maiddais...@outlook.com>
---
 mingw-w64-libraries/winpthreads/configure.ac   |  9 +++++++++
 .../winpthreads/include/pthread_compat.h       | 18 ++++++------------
 2 files changed, 15 insertions(+), 12 deletions(-)

The patch looks good to me. I have pushed it to master now.

I am actually in favor of this solution. I have another very similar setup with Meson, with this definition in pre-compiled header instead.


I have a question. What do you think about adding .pc (pkg-config) file for 
winpthreads?

If winpthreads is linked as `-pthread` (standard? no?) then there's no need to do that, because nobody would use pkgconf to look for 'winpthreads'.


There is also a problematic interaction between pthread_compat.h and autoconf's 
AC_TYPE_PID_T. With MSVC, this check will fail and it will

It is an unfortunate mistake. If VC defines `pid_t` then the VC definition 
should be preferred.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to