I'm curious why there is so much about MT and MD on Windows and no-one is talking about linux. In linux, afaik, there is the libc.so as the MD equivalent, and the libc.a as the MT equivalent.
Since there is the possibility to link the c runtime statically or dynamically, and you can link both static and dynamic libs together when building a single executable, you have to have the same issues as with combining MT and MD libraries, or multiple versions of the c runtime on windows.
So my question, are the same problems present on linux, or is there some system/pattern on linux that prevents these issues? In my opinion, the problems are the same as on windows, it's just weird I cannot find much about these issues.
/MT
and /MD
are not really Windows, but Visual Studio. While both are from Microsoft, there is a very important distinction. The two products are far more separated than is typically the case on Linux.
In particular, on Linux it's never been clear whether libc
is part of the OS, or part of the C compiler. That didn't really matter much, though as C didn't evolve that fast anyway.
The real problem on Linux is libstdc++
, which depends on libc
, and as such got dragged into the same dependency issue.
The result is that Visual Studio 2019 can compile C++20 code for Windows XP, and with /MT
it will just work. But compile on Debian 10, and you'll get a dependency on the Debian 10 libc which won't even work on Debian 9.