msvcrtlibc

Is MSVCRT under Windows like glibc (libc) under *nix?


I frequently come across Windows programs that bundle in MSVCRT (or their more current equivalents) with the program executables. On a typical PC, I would find many copies of the same .DLL's. My understanding is that MSVCRT is the C runtime library, somewhat analogous to glibc/libc.so under *nix.

Why do Windows programs have to bring along their C libraries with them, instead of just sharing the system-wide libc?


Update: thanks to Shog9, I started to read about SxS, which has further opened up my eyes to the DLL linkage issues (DLL Hell) - Link is one useful intro to the issue...


Solution

  • [I'm the current maintainer of the Native SxS technology at Microsoft]

    New versions of MSVCRT are released with new versions of Visual Studio, and reflect changes to the C++ toolset. So that programs compiled with versions of VS released after a particular version of Windows continue can work downlevel (such as VS 2008 projects on Windows XP), the MSVCRT is redistributable, so it can be installed there.

    CRT installation drops the libraries into %windir%\winsxs\, which is a global system location, requiring administrator privileges to do so.

    Since some programs do not want to ship with an installer, or do not want the user to need administrator privileges on the machine to run their installer, they bundle the CRT directly in the same directory as the application, for private use. So on a typical machine, you'll find many programs that have opted for this solution.