[Mingw-w64-public] gcc parameter -mcrtdll= for choosing Windows C RunTime DLL library

LIU Hao lh_mouse@126.com
Mon Nov 21 05:21:53 GMT 2022


在 2022/11/20 23:06, Pali Rohár 写道:
> Thank you for explaining more details. My simple patch takes this in
> care and defines also __MSVCRT_VERSION__ to the correct value based on
> -mcrtdll parameter.

Apologies for reading your message only partially. I thought your patch was the same as MSYS2's. It 
turns out that you have made further progress; that's very kind of you.

As for the patch itself: It's probably safe to switch between MSVCR* DLLs, but switching from MSVCR* 
to UCRT requires a complete rebuild due to differences in implementation of stdio functions and 
definition of `time_t` on x86. There are more reasons, for example, that MSVCR80 and 90 require 
architecture-specific manifests to load, and MSVCR80 to 120 are not pre-installed and have to be 
installed by users. These could explain why `-mcrtdll=` hasn't gained wide use, while UCRT-based 
toolchains have.

So, the patch may be acceptable, but I don't think it will solve the issue for you. A user should 
usually choose MSVCRT or UCRT, which however requires rebuilding the CRT. For those who really 
really wish to link against MSVCR100 for example, it's always doable to pass `-nodefaultlibs` to 
GCC, and specify desired libraries explicitly.


-- 
Best regards,
LIU Hao

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20221121/9e6409b9/attachment.sig>


More information about the Gcc mailing list