SUMMARY
There are six types of reusable libraries:
- Static Single Threaded Library
(Debug/Release)
- Static Multithreaded Library (Debug/Release)
- Dynamic
Link Library (DLL)(Debug/Release)
Note Each library has a debug version and a release version.
The DLL is multithread-safe and a single-thread version of the CRT library is not provided for DLLs. If the reusable
library or any user of the library is using multiple threads, then the
library needs to be a multithread-safe library type.
Note Debug libraries and compiler switches /MLd, /MTd, and /MDd are only
available in Visual C++ versions 4.0 and later.
The following table shows which compiler switch should be used for building
each of the six types of reusable libraries (all DLL types are multithread-safe). Any project that uses the reusable library should use the same compiler
switch. When using the /ML(default), /MLd, /MT, /MTd, /MD, or /MDd compiler
switches, the compiler places the default library name (listed under the
Library column) in the object file.
Reusable Library Switch Library Macro(s) Defined
----------------------------------------------------------------
Single Threaded /ML LIBC (none)
Static MultiThread /MT LIBCMT _MT
Dynamic Link (DLL) /MD MSVCRT _MT and _DLL
Debug Single Threaded /MLd LIBCD _DEBUG
Debug Static MultiThread /MTd LIBCMTD _DEBUG and _MT
Debug Dynamic Link (DLL) /MDd MSVCRTD _DEBUG, _MT, and _DLL
You can view an object module to determine which switch was used when
it was built by using this command:
dumpbin /all <object>.obj
Look in the section titled RAW DATA #1. In the right-most column, the
default libraries will be listed.