Go VC Run Library Md/mdd/mt/mtd/ml/mld

Source: Internet
Author: User

VC Compilation Options

 - 多线程(/MT) - 多线程调试        (/MTd) - 多线程DLL        (/MD) - 多线程调试DLL (/MDd)

C run-Time library files

 - Single thread(static link) ML                  libc.lib  - Debug single thread(static link) MLd           libcd.lib  - MultiThread(static link) MT                    libcmt.lib   - Debug multiThread(static link) MTd             libcmtd.lib - MultiThread(dynamic link) MD                   msvert.lib  - Debug multiThread(dynamic link) MDd            msvertd.lib

Differences between various C run-time libraries

    1. Statically linked single-wire libraries
      A statically linked single-threaded libraries can only be used for single-threaded applications, and the target code of the C run-time library is eventually compiled into the application's binaries. The/ML compilation option allows you to set up a single line of Visual C + + using static links
      Libraries

    2. Statically linked multi-line libraries
      The target code for statically linked multiline libraries is also eventually compiled in the application's binaries, but it can be used in multithreaded programs. The/MT compilation option allows you to set up a multithreaded library that uses static linking for Visual C + +.

    3. Dynamically linked run-time libraries
      The dynamically linked run-time library stores all C library functions in a separate dynamic-link library MSVCRTxx.DLL, MSVCRTxx.DLL handles multithreading issues. Use the/MD compilation option to set the runtime library for Visual C + + to use dynamic linking.

The/MDd,/MLD, or/MTD options use the Debug Runtime Library (debug version of the runtime Library) to correspond to/MD,/ml, or/MT respectively. The debug version of the runtime Library contains debug information, with some protection mechanisms to help detect errors, enhanced detection of errors, and therefore less operational performance than the release version.

The following is a description of MSDN's Visual C + + Compiler options: These options select a single-threaded or multithreaded run-time routine, indicate whether a multi-threaded module is a DLL, and select a release or debug version of the runtime library.

  • /MD define _MT and _dll to select multithreaded specific versions and DLL-specific versions of the runtime routines from the standard. h file at the same time. This option also causes the compiler to put the library name MSVCRT.lib into the. obj file. Applications compiled with this option are statically linked to MSVCRT.lib. The library provides a layer of code that allows the linker to resolve external references. The actual work code is contained in the MSVCR71. DLL, the library must be available at run time for applications that are linked to MSVCRT.lib.
    When using/MD with the _static_cpplib (/d_static_cpplib) defined, it causes the application to link through the static multithreaded standard C + + library (libcpmt.lib) rather than the dynamic version (MSVCPRT.lib) while still MSVCRT.lib dynamically linked to the main CRT.

  • /MDD defines _DEBUG, _MT, and _dll to select Debug multithreaded specific versions and DLL-specific versions of the runtime routines from the standard. h file. It also causes the compiler to put the library name MSVCRTD.lib into the. obj file.

  • /ML causes the compiler to put the library name LIBC.lib into the. obj file so that the linker can use LIBC.LIB to parse the external symbol. This is the default action for the compiler. LIBC.lib does not provide multithreading support.

  • /MLD defines the _DEBUG and causes the compiler to put the library name LIBCD.lib into the. obj file so that the linker uses LIBCD.LIB to parse the external symbol. LIBCD.lib does not provide multithreading support.

  • /MT defines the _MT to select a multithreaded specific version of the run-time routine from the standard header (. h) file. This option also causes the compiler to put the library name LIBCMT.lib into the. obj file so that the linker can use LIBCMT.lib to resolve external symbols. Creating multithreaded programs requires/MT or/MD (or their debug equivalent option/MTd or/MDD).

  • /MTD defines _DEBUG and _MT. Defining _MT causes a multithreaded specific version of the run-time routine to be selected from the standard. h file. This option also causes the compiler to put the library name LIBCMTD.lib into the. obj file so that the linker can use LIBCMTD.lib to resolve external symbols. Creating multithreaded programs requires/MTD or/MDD (or their non-debug equivalent option/MT or MD).

  • /LD Creating DLLs
    Pass the/dll option to the linker. The linker looks for the DllMain function, but it does not need the function. If you do not write the DllMain function, the linker inserts a DllMain function that returns TRUE.
    Link DLL startup code
    If an export (. exp) file is not specified on the command line, an import library (. lib) is created, and the import library is linked to the application that called your DLL. Interpret/fe as a named DLL instead of an. exe file; The default program name becomes the base name. dll instead of the base name. exe. If one of the/M options has not been explicitly specified, the default run-time library support is changed to/MT.

  • /ldd creating a debug DLL, defining _DEBUG
    Warning do not mix static and dynamic versions of the run-time library. Having multiple copies of a run-time library in one process can cause problems because static data in the replica is not shared with other replicas. The linker prohibits both a static version and a dynamic version link within an. exe file, but you can still use two (or more) copies of the run-time library. For example, when used with an. exe file that is linked with a dynamic (DLL) version of the run-time library, a dynamic-link library that is linked with a static (non-DLL) version of the run-time library can cause problems. (You should also avoid mixing the debug and non-debug versions of these libraries in one process.)

Go VC Run Library Md/mdd/mt/mtd/ml/mld

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.