Quantcast
Channel: chooru_code » visual c++
Viewing all articles
Browse latest Browse all 14

Visual C++: C Run-Time Libraries

$
0
0

Every Visual C++ project is linked with a C run-time library. This is called the CRT in Microsoft literature.

Depending on the support for multi-threading there are 2 kinds of CRT:

  • Single threaded CRT: This can only be statically linked. This CRT is used if one of the compiler options /ML or /MLd is specified. It would be linked with libc.lib or libcd.lib respectively for Release and Debug modes. The single-threaded CRT is completely deprecated and should not be used! :x
  • Multi-threaded CRT: This is the default kind of CRT and should be used always.

The type of linking (static or dynamic) and the configuration (Release or Debug), lead to 4 kinds of multi-threaded CRT:

  • Release mode and statically linked: Specified using the compiler option /MT. The library file used is libcmt.lib.
  • Debug mode and statically linked: Specified using the compiler option /MTd. The library file used is libcmtd.lib.
  • Release mode and dynamically linked: Specified using the compiler option /MD. The library file used is msvcrt.lib and the DLL file used at run-time is msvcr100.dll (depends on Visual C++ version).
  • Debug mode and dynamically linked: Specified using the compiler option /MDd. The library file used is msvcrtd.lib and the DLL file used at run-time is msvcr100d.dll (depends on Visual C++ version).

Reference: C Run-Time Libraries at MSDN.



Viewing all articles
Browse latest Browse all 14

Trending Articles