Replace MSVCR120.dll fallback with the Universal CRT on Windows.#23345
Conversation
…vcrt120 is selected automatically, allowing the user to still explicitly override the with that library.
|
We don't have to deprecate the MinGW stuff, we could just switch from msvcrt120.lib to ucrtbase.lib that is already in the mingw library folder. The only complication is that it needs an additional library vcruntime140.lib to be passed on the linker command line. The additions to the VS detection look good but for the support of future platform versions as mentioned. |
…Improved VC tool-chain detection.
|
@rainers That is a really good idea. I've updated the pull to implement this request. |
|
@rainers That made things quite a bit simpler. If everything looks good to you, please go ahead and merge it. |
rainers
left a comment
There was a problem hiding this comment.
Thanks, looks much cleaner. Just a few non-critical nitpicks...
| return na < nb ? -1 : 1; | ||
| if (!hasA && !hasB) | ||
| return 0; | ||
| if (*a) ++a; // skip separator (typically '.') |
There was a problem hiding this comment.
Same here.
Not sure if it is worth skipping/comparing multiple non-numeric characters.
There was a problem hiding this comment.
I think this is acceptable because non-numerics are not typically part of any MSFT version specifier. And version postfix data as-in SemVer is not comparable using </> anyways so it can never be deterministic in finding the "latest" version. Likewise, the prefix v in SemVer would always be skipped as well. So IMO, skipping non-numerics is reasonable here.
This PR deprecates the MSVCR120.dll fallback when DMD cannot locate the Windows SDK or Visual Studio installations and requires the use the Universal CRT. It also updated some of the fallback detection paths to include newer versions of Visual Studio and deprecates detection of versions of VS that do not support UCRT.
A more detailed NG post about the reasons for this PR is located here: https://forum.dlang.org/thread/wtfjroxawypsyuhmqotl@forum.dlang.org
This PR was generated with LLM's.
Model Name: Opus 4.8
Prompt:
We are looking to deprecate all non-UCRT C runtimes, including the default/fallback MSVCR120 runtime that does not support "%zd" and the MinGW support as MingGW is deprecating MINGW64 support in favor if UCRT (here: https://www.msys2.org/news/#2026-03-15-deprecating-the-mingw64-environment). Next we want to deprecate support for all versions of Visual Studio prior to 2015 as those versions do not support the UCRT. The desired goal of this plan is that UCRT is the only CRT library used by DMD on Windows. We want to keep the "-mscrtlib" override in case the user wishes to provide a different CRT. We also need to make sure the detection logic for library paths and linker paths is up to date for the most recent versions of the Windows SDK and UCRT, as well as the detection logic for the linker.