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 informations. As
such we have to add a mutex protecting _wspawn*e calls. That doesn't fix
the issue completely, as other modules in an application might call
_wspawn*e functions, but it's still a good measure.
I was contemplating about adding a mutex only if using the MSVCRT-based
toolchain. I guess I can include a CRT header and test for #if
!defined(_UCRT) && !defined(GLIB_STATIC_COMPILATION).
I think that sounds quite reasonable
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).
Out of curiosity, by running the echo | gcc -dM -E - command from the MSYS2
MinGW UCRT x64 shell I can see:
#define __MSVCRT__ 1
Is that macro necessary in a UCRT-based toolchain?
I think that define has a longer legacy, and stopping defining it might be
more risky.
Anyway, that's a compiler builtin define - the compiler doesn't really
know on its own what the headers provide - so such tests that don't
include any headers can't really decide on that matter. You might want to
add e.g. something like -include stddef.h to see more from the headers
too.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public