Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread Luca Bacci
>> Or maybe the mutex can be added to the MinGW-w64 headers? >Hmm, I'm not sure - in one sense, mingw-w64 should just expose the >platform as accurately as possible, while we do try to fix some of the >sharper edges (from a portability point of view too) Yes, that makes sense, and afterall the i

Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread LIU Hao
在 2022-06-23 21:38, Luca Bacci 写道: #define __MSVCRT__ 1 Is that macro necessary in a UCRT-based toolchain? If you have GCC source you may have a look at 'gcc/config/i386/mingw32.h', where there is builtin_define ("__MSVCRT__"); So it's defined unconditionally, no matter whether it is

Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread Martin Storsjö
On Thu, 23 Jun 2022, Luca Bacci wrote: Thank you very much, Biswapriyo Nath and Martin Storsjö! I ask because in GLib we have to work around a MSVCRT issue. Basically, the _wspawn*e functions from the MSVCRT are not thread safe, see https://gitlab.gnome.org/GNOME/glib/-/issues/2509 for more inf

Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread Luca Bacci
Sorry, the condition should be #if defined(_UCRT) && !defined(GLIB_STATIC_COMPILATION) Luca Il giorno gio 23 giu 2022 alle ore 15:34 Luca Bacci ha scritto: > Thank you very much, Biswapriyo Nath and Martin Storsjö! > > I ask because in GLib we have to work around a MSVCRT issue. Basically, > th

Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread Luca Bacci
Thank you very much, Biswapriyo Nath and Martin Storsjö! I ask because in GLib we have to work around a MSVCRT issue. Basically, the _wspawn*e functions from the MSVCRT are not thread safe, see https://gitlab.gnome.org/GNOME/glib/-/issues/2509 for more informations. As such we have to add a mutex

Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread Martin Storsjö
On Wed, 22 Jun 2022, Luca Bacci wrote: As per the title, say I compile a static library archive using mingw-w64-ucrt, can I use that archive with mingw-w64-msvcrt? (or viceversa) Indeed, as Biswapriyo said, in general, you can't mix. In practice, mixing them does work in many cases (so if you

Re: [Mingw-w64-public] Can static libraries (object files) compiled for MSVCRT vs UCRT be mixed?

2022-06-23 Thread Biswapriyo Nath
AFAIK, it is not suggested to mix msvcrt and ucrt libraries. With mingw, programs are not "truely" linked statically with system crt. The compiled binaries also depends on msvcrt.dll or ucrtbase.dll. `_UCRT` can be used to distinguish those two crt. But that macro is used in headers/crt, not by com