gpt4 book ai didi

What does MT and MD stand for?(MT和MD代表什么?)

翻译 作者:bug小助手 更新时间:2023-10-26 22:03:29 29 4
gpt4 key购买 nike



I'm trying to wrap my head around how MT and MD options are used when compiling C/C++ projects. However, without being able to expand these supposed abbreviations to meaningful phrases, I forget which one is which from one paragraph to the next. Strangely enough none of the text I've read starts by defining the M, the T and the D. What do they stand for?

我正在试图理解编译C/C++项目时如何使用MT和MD选项。然而,由于无法将这些假定的缩略语扩展为有意义的短语,我忘记了从一段到下一段哪个是哪个。奇怪的是,我读过的文章都不是从定义M、T和D开始的,它们代表什么?


更多回答

learn.microsoft.com/en-us/cpp/build/reference/…

Learn.microsoft.com/en-us/cpp/build/reference/…

MultiThreaded and MultiThreadedDebug.

多线程和多线程调试。

@Eneroth3, The full text of the abbreviations is certainly in there: Mutlithreaded and Multithreaded DLL.

These are acronyms, not abbreviations. They aren't required to actually stand for anything, grammatically speaking.

这些是首字母缩写,而不是缩写。从语法上讲,他们并不需要真正代表任何东西。

A long long time ago there was a version of CRT that was not Multithreaded. Option /ML. So the M definitely does not mean Multithreaded. This all happened way too long ago, whomever made the choice is sipping pina-coladas on a sunny beach today.

很久很久以前,有一个CRT版本不是多线程的。Option /ML。所以M绝对不是多线程的意思。这一切都发生在太久以前,无论是谁做出了选择,今天是在阳光明媚的海滩上啜饮凤梨可乐。

优秀答案推荐

From the compiler options link given by chris above:

从Chris上面给出的编译器选项链接:



https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically?view=vs-2019

Https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options-listed-alphabetically?view=vs-2019



/MD    Creates a multithreaded DLL using MSVCRT.lib.
/MDd Creates a debug multithreaded DLL using MSVCRTD.lib.
/MT Creates a multithreaded executable file using LIBCMT.lib.
/MTd Creates a debug multithreaded executable file using LIBCMTD.lib.


Thus MT stands for Multithreaded and MD stands for Multithreaded DLL.

因此,MT代表多线程,MD代表多线程DLL。



These switches for cl.exe specify which C runtime library to link against; /MT specifies to link with LIBCMT.LIB; /MD specifies to link with MSVCRT.LIB.

Cl.exe的这些开关指定要链接到哪个C运行时库;/MT指定链接到LIBCMT.LIB;/MD指定链接到MSVCRT.LIB。



The different CRT libraries are described in greater detail here. The primary difference between LIBCMT and MSVCRT is that the former links the CRT statically into your output file, whereas MSVCRT links to the VC runtime DLL (which, unlike its name suggests, is not MSVCRT.DLL (see here)).

这里更详细地描述了不同的CRT库。LIBCMT和MSVCRT之间的主要区别是前者将CRT静态链接到您的输出文件,而MSVCRT链接到VC运行时DLL(与其名称不同,它不是MSVCRT.DLL(参见此处))。



DLL and internal may be used as mnemonic to distinguish /MD from /MT.

DLL和internal可以用作助记符来区分/MD和/MT。



I also searched this for my question, and here are more detailed explanations by MSDN:

我也在上面搜索了我的问题,以下是MSDN更详细的解释:


MSVC compiler options

MSVC编译器选项


(emphasis mine)

(重点是我的)



/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.


Applications compiled with this option are statically linked to
MSVCRT.lib. This library provides a layer of code that enables the
linker to resolve external references. The actual working code is
contained in MSVCRversionnumber.DLL, which must be available at run
time
to applications linked with MSVCRT.lib.




/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.




/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.




/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.



The page also explains other compiler options /LD and /LDd, which are used when creating DLLs.

该页面还解释了创建DLL时使用的其他编译器选项/LD和/LDD。


更多回答

If MT means for MulthiThreaded I'd expect MultThreaded Dll to be written as MDT. That or simply M for Multithreaed. But thanks for actually answering the question!

如果MT意味着多线程,我希望多线程DLL被写为MDT。或者简单地说,M代表多重性。但是谢谢你回答了这个问题!

Not correct. /LD creates DLL and /LDd creates debug DLL. /MD links runtime dynamically, while /MT links it statically.

不正确。/LD创建DLL,/LDD创建调试DLL。/MD动态链接运行时,而/MT静态链接它。

@ScienceDiscoverer are you arguing with Microsoft's own documentation, whose text I simply copied and pasted? /LD creates a single threaded DLL, not a multithreaded one

@Science Discoverer您是否在争论Microsoft自己的文档,而我只是复制并粘贴了它的文本?/LD创建的是单线程DLL,而不是多线程DLL

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com