On Sun, 4 Oct 2026, Pali Rohár wrote:
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
Ok, fair enough - I had forgotten about that interpretation of it.
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.
Indeed - and not just specifically for GPL compliance, but overall, that
it doesn't depend on any separate redistributable.
So it makes sense that the vcruntime140_threads.dll is never enabled by
default (like any other versioned msvcr* is not enabled by default).
Yes, I think that's a reasonable stance on the matter.
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.
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.
Yes, but if it would be there in the threads.h header, it would be
slightly confusing as compiling still would work, it would just not link
successfully unless you use the right -mcrtdll.
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?
Adding import libraries for that sounds fine in any case.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public