The MSVC CRT library is not overrideable by other build systems #107570
Labels
A-linkage
Area: linking into static, shared libraries and binaries
O-windows-msvc
Toolchain: MSVC, Operating system: Windows
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
For
-windows-msvc
targets linking the C runtime (e.g. C main, etc) is done in thelibc
crate which then hard codes the CRT startup libraries to use, which means they can't be overridden (without hacks orno_std
) except to choose between dynamic or static linking. This makes it difficult to select the right CRT for certain builds. This matters particularly when integrating Rust alongside existing C/C++ build systems. The same CRT must be used in all cases.I would propose that
rustc
should behave more likecl
(the MSVC compiler) in this case. We should use/DEFAULTLIB:
to link the CRT so the library is overridable rather than hard coded. This also means it can work with existing tools rather than needing anything custom forrustc
.The text was updated successfully, but these errors were encountered: