Friday, July 22, 2011

C++ - MD and MT compile option


Simple explanation



Microsoft Visual C++ Static and Dynamic Libraries





http://shitohichiumaya.blogspot.com/2009/10/visual-c-md-and-mt-compile-option.html

- MT: Multi-threaded static library. This is good for distribution a whole application package, since everything is statically linked and there is no dependency to the environment.

- MD: Multi-threaded Dynamic link library. If you distribute some library instead of a whole application, dynamically linked runtime is better since, some part of the program uses one version of runtime, and the other uses different version,this causes a trouble. For example, 'new'ed some memory at one version of runtime, and 'delete'd by other version of runtime could be a trouble.




http://dev.mobixo.net/2008/03/use-mtd-or-mdd.html



/MD
causes application to use the multithread- and DLL-specific version of the run-time library. Applications compiled with this option are linked to MSVCRT.lib. This library provides a layer of code that allows the linker to resolve external references. The actual working code is contained in MSVCR80.DLL, which must be available at run time to applications linked with MSVCRT.lib.

/MT

causes your application to use the multithread, static version of the run-time library. Defines _MT and causes the compiler to place the library name LIBCMT.lib into the .obj file so that the linker will use LIBCMT.lib to resolve external symbols.

No comments:

Post a Comment