pub enum Crt {
Static,
Dll,
}Expand description
Which of Microsoft’s two C runtimes a program in the MSVC environment is linked against.
cl.exe spells the choice /MT and /MD, and here it is -fms-runtime-lib=static and
-fms-runtime-lib=dll, which is clang’s spelling. Two sets of libraries and two macros: the
headers read _MT for both and _DLL only for the second, and that is how a header knows its
functions are imported from a DLL rather than linked into the program.
The static one is the default, which is the opposite of cl.exe, and the reason is the machine
the program is copied to. The universal CRT is part of Windows 10 and later, but the Visual C++
runtime is not: vcruntime140.dll arrives with the redistributable, and a program linked /MD
on a machine that never installed it does not start. A program linked /MT carries both and
starts anywhere, which is what the mingw-w64 rows give without being asked.
Variants§
Static
/MT: libcmt.lib, libucrt.lib and libvcruntime.lib, all three linked into the
program.
Dll
/MD: msvcrt.lib, ucrt.lib and vcruntime.lib, which are import libraries for
ucrtbase.dll and vcruntime140.dll with the startup code in the first of them.