On Sunday 04 October 2026 15:18:44 Martin Storsjö wrote: > On Sun, 4 Oct 2026, Pali Rohár wrote: > > > msvc already provides C11 threads.h support via its own header file and > > runtime library vcruntime140_threads.dll (available for x86, amd64 and > > arm64; but not for arm32). This library is part of the Visual C++ 2022 > > redistributable package version 14.38.32919.0. > > I would prefer to not go in this direction. > > One main feature of the CRTs we primarily use (msvcrt, UCRT) is that they > are shipped as part of the OS - this doesn't hold for the separate Microsoft > redistributables. > > This distinction is important for user code that is strictly GPL, regarding > what non-opensource libraries you can link them against. (I.e., OS provided > closed source is ok, separately distributed closed source is not ok.)
I do not want to open this discussion because I think it is never ending one. Just I would like to point out that GNU people says that it is fine to link GPL application with MS C++ runtime libraries: https://www.gnu.org/licenses/gpl-faq.html#WindowsRuntimeAndGPL But I understand that it is always better to only stick with msvcrt.dll and UCRT set of libs (api-ms-win-crt-*.dll) as there seems to be consensus by all parties that this is fine for GPL applications. So it makes sense that the vcruntime140_threads.dll is never enabled by default (like any other versioned msvcr* is not enabled by default). > > I think that for future, mingw-w64 could provide own implementations of > > C11 threads.h functions (for static linking) compatible with the msvc > > runtime functions. I have checked if there is a wine implementation or > > documentation, but wine project has not documented this yet. > > Yes, having something of our own would feel more in the right direction. > > On the other hand, making it possible to use the MSVC thread library might > be something that adds value for someone still, but separate alternatives > would need to coexist in the same threads.h header though. I wouldn't want > the setup that relies on vcruntime140_threads.dll to be the default. > > // Martin With my proposed changes, it is only available when compiling with the gcc -mcrtdll=ucrt_vcruntime140 command line switch, which is not used by default. For normal/default UCRT builds, it is not available. My idea was to provide at least something at the beginning. So what about just import libraries for vcruntime140_threads.dll if you think that the threads.h would need to wait for some other implementation? _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
