Skip to content

Commit 67585a2

Browse files
Merge pull request MicrosoftDocs#5150 from MicrosoftDocs/main638724762296493742sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 20177e3 + 700ff22 commit 67585a2

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed
Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: /MD, /MT, /LD (Use Run-Time Library)"
3-
title: "/MD, -MT, -LD (Use Run-Time Library)"
4-
ms.date: "07/17/2019"
2+
description: "Learn more about: /MD, /MT, /LD (Use runtime library)"
3+
title: "/MD, -MT, -LD (Use runtime library)"
4+
ms.date: "01/13/2025"
55
f1_keywords: ["/ld", "/mt", "VC.Project.VCCLWCECompilerTool.RuntimeLibrary", "VC.Project.VCCLCompilerTool.RuntimeLibrary", "/md", "/ml"]
66
helpviewer_keywords: ["/MT compiler option [C++]", "-MD compiler option [C++]", "threading [C++], multithread compiler option", "MSVCRTD.lib", "MSVCRT.lib", "LIBCMT.lib", "MD compiler option [C++]", "/MD compiler option [C++]", "MT compiler option [C++]", "LD compiler option [C++]", "MDd compiler option [C++]", "-MDd compiler option [C++]", "LIBCD.lib", "-MTd compiler option [C++]", "MTd compiler option [C++]", "/MTd compiler option [C++]", "-LD compiler option [C++]", "/MDd compiler option [C++]", "multithread compiler option", "_STATIC_CPPLIB symbol", "LIBC.lib", "/LD compiler option [C++]", "DLLs [C++], compiler options", "LIBCMTD.lib", "-MT compiler option [C++]"]
7-
ms.assetid: cf7ed652-dc3a-49b3-aab9-ad60e5395579
87
---
9-
# /MD, /MT, /LD (Use Run-Time Library)
8+
# /MD, /MT, /LD (Use runtime library)
109

11-
Indicates whether a multithreaded module is a DLL and specifies retail or debug versions of the run-time library.
10+
Indicates whether a multithreaded module is a DLL and specifies retail or debug versions of the runtime library.
1211

1312
## Syntax
1413

@@ -22,27 +21,25 @@ Indicates whether a multithreaded module is a DLL and specifies retail or debug
2221

2322
|Option|Description|
2423
|------------|-----------------|
25-
|**/MD**|Causes the application to use the multithread-specific and DLL-specific version of the run-time library. Defines `_MT` and `_DLL` and causes the compiler to place the library name MSVCRT.lib into the .obj file.|
26-
|**/MDd**|Defines `_DEBUG`, `_MT`, and `_DLL` and causes the application to use the debug multithread-specific and DLL-specific version of the run-time library. It also causes the compiler to place the library name MSVCRTD.lib into the .obj file.|
27-
|**/MT**|Causes the 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.|
28-
|**/MTd**|Defines `_DEBUG` and `_MT`. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols.|
29-
|**/LD**|Creates a DLL.<br /><br /> Passes the **/DLL** option to the linker. The linker looks for, but does not require, a `DllMain` function. If you do not write a `DllMain` function, the linker inserts a `DllMain` function that returns TRUE.<br /><br /> Links the DLL startup code.<br /><br /> Creates an import library (.lib), if an export (.exp) file is not specified on the command line. You link the import library to applications that call your DLL.<br /><br /> Interprets [/Fe (Name EXE File)](fe-name-exe-file.md) as naming a DLL rather than an .exe file. By default, the program name becomes *basename*.dll instead of *basename*.exe.<br /><br /> Implies **/MT** unless you explicitly specify **/MD**.|
30-
|**/LDd**|Creates a debug DLL. Defines `_MT` and `_DEBUG`.|
24+
|**/MD**|Use the multithread-specific and DLL-specific version of the runtime library. Defines `_MT` and `_DLL`. The linker uses the `MSVCRT.lib` import library to resolve runtime symbols.|
25+
|**/MDd**|Use the debug multithread-specific and DLL-specific version of the runtime library. Defines `_DEBUG`, `_MT`, and `_DLL`. The linker uses the `MSVCRTD.lib` import library to resolve runtime symbols.|
26+
|**/MT**| Use the multithread, static version of the runtime library. Defines `_MT`. The linker uses `LIBCMT.lib` to resolve runtime symbols.|
27+
|**/MTd**| Use the debug multithread, static version of the runtime library. Defines `_DEBUG` and `_MT`. The linker uses `LIBCMTD.lib` to resolve runtime symbols.|
28+
|**/LD**|Create a DLL.<br /><br /> Passes the **/DLL** option to the linker. The linker looks for, but does not require, a `DllMain` function. If you don't write a `DllMain` function, the linker inserts a `DllMain` function that returns TRUE.<br /><br /> Links the DLL startup code.<br /><br /> Creates an import library (`.lib`), if an export (`.exp`) file is not specified on the command line. You link the import library to applications that call your DLL.<br /><br /> Interprets [/Fe (Name EXE File)](fe-name-exe-file.md) as naming a DLL rather than an `.exe` file. By default, the program name becomes *basename*.dll instead of *basename*.exe.<br /><br /> Implies **/MT** unless you explicitly specify **/MD**.|
29+
|**/LDd**|Create a debug DLL. Defines `_MT` and `_DEBUG`.|
3130

32-
For more information about C run-time libraries and which libraries are used when you compile with [/clr (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md), see [CRT Library Features](../../c-runtime-library/crt-library-features.md).
31+
For more information about C runtime libraries and which libraries are used when you compile with [/clr (Common Language Runtime Compilation)](clr-common-language-runtime-compilation.md), see [CRT Library Features](../../c-runtime-library/crt-library-features.md).
3332

34-
All modules passed to a given invocation of the linker must have been compiled with the same run-time library compiler option (**/MD**, **/MT**, **/LD**).
33+
All modules passed to a given invocation of the linker must have been compiled with the same runtime library compiler option (**/MD**, **/MT**, **/LD**).
3534

36-
For more information about how to use the debug versions of the run-time libraries, see [C Run-Time Library Reference](../../c-runtime-library/c-run-time-library-reference.md).
35+
For more information about how to use the debug versions of the runtime libraries, see [C runtime Library Reference](../../c-runtime-library/c-run-time-library-reference.md).
3736

3837
For more about DLLs, see [Create C/C++ DLLs in Visual Studio](../dlls-in-visual-cpp.md).
3938

4039
### To set this compiler option in the Visual Studio development environment
4140

4241
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
43-
4442
1. Select the **Configuration Properties** > **C/C++** > **Code Generation** property page.
45-
4643
1. Modify the **Runtime Library** property.
4744

4845
### To set this compiler option programmatically
@@ -51,5 +48,6 @@ For more about DLLs, see [Create C/C++ DLLs in Visual Studio](../dlls-in-visual-
5148

5249
## See also
5350

54-
[MSVC Compiler Options](compiler-options.md)<br/>
55-
[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md)
51+
[MSVC Compiler Options](compiler-options.md)\
52+
[MSVC Compiler Command-Line Syntax](compiler-command-line-syntax.md)\
53+
[The Great C Runtime (CRT) Refactoring](https://devblogs.microsoft.com/cppblog/the-great-c-runtime-crt-refactoring/)

0 commit comments

Comments
 (0)