哪些提供了C/C ++运行时库? [英] What provids C/C++ runtime libraries?
问题描述
对于Windows SDK和平台工具集以及C/C ++运行时库,我有以下两个问题.
-
a)Windows SDK与C/C ++运行时和平台工具集之间的关系是什么?可以说C ++运行时库&平台工具集由Windows SDK提供?由于我们主要从Visual Studio项目设置中处理平台工具集,因此想了解Visual Studio是否通过安装所需的Windows SDK版本来控制C ++运行时库和平台工具集版本?
-
b)我想澄清的另一件事是,如果说一个版本的平台工具集可以与其他版本的Windows SDK一起使用是正确的话,或者这些完全无关?例如.在我的Visual Studio中,我看到"Windows SDK版本"是Windows 10,平台工具集是v142.我可以将"Windows SDK版本"设置为Windows 8.1并将工具集保持为v142吗?如果是,那是什么意思?
这让我很困惑,而且似乎无法得到来自不同人的如此多不同解释的正确图片.
TL; DR::如果您使用的是Visual C ++,请使用
. UCRTBASE.DLL
是操作系统的一部分,并通过Windows Update提供服务.在Visual C ++ REDIST程序包中包含它的下层"版本,但是通常您应该将其视为"OS"部分.这是"C运行时".这些标头,导入库和位于Windows 10 SDK中.您还可以在 C:\ Program Files(x86)\ Windows Kits \ 10 \ Source \< version> \ ucrt
中找到源代码. MSVCP * .DLL
这是"C ++运行时"库,基本上类似于 std :: vector
等.标头,导入库等在Visual C ++产品中.您可以在 C ++/CX扩展(又名/ZW
) VCAMP140.DLL
用于 C ++ AMP VCOMP140.DLL
用于此博客文章和<一个href ="https://devblogs.microsoft.com/cppblog/introducing-the-universal-crt/" rel ="nofollow noreferrer">这一个
基本上,C运行时(UCRTBASE)部分是简单的 extern"C"
接口,因此ABI定义明确,因此可与Visual C ++的多个版本甚至其他编译器一起使用.因此,您所使用的UCRT的确切版本主要取决于您通过 WindowsTargetPlatformVersion
使用的OS和Windows 10 SDK.您也可以根据此博客>.
C ++运行时(MSVCP * .DLL)包含许多内联和公开的内存布局,并且历史上在Visual C ++版本之间存在重大变化.就是说,对于VS 2015 Update 3,VS 2017和VS 2019,VC团队在此处保留了二进制兼容"的意义,这意味着,如果您有一个静态库,该静态库使用来自 PlatformToolset
v140/v141,它将通过v142成功链接到Visual C ++的更高版本版本.尚不清楚这是否会在将来持续,但是对于每个 解决方案
TL;DR: If you are using Visual C++, and use the standard REDIST instructions from Microsoft Docs, then these details shouldn't really matter to you.
With VS 2015 and later, the "C/C++ Runtime" has been refactored into three pieces:
UCRTBASE.DLL
is part of the OS and serviced through Windows Update. There are 'down-level' versions of it included in the Visual C++ REDIST package, but generally you should think of this as the "OS" part. This is the "C Runtime". These headers, import libraries, and are in the Windows 10 SDK. You can find the source for it there as wellC:\Program Files (x86)\Windows Kits\10\Source\<version>\ucrt
.MSVCP*.DLL
This is the "C++ Runtime" library, basically stuff likestd::vector
et al. The headers, import libraries, and such are in the Visual C++ product. You can find the source to it on GitHub per this blog post.VCRUNTIME*.DLL
has the entry-points needed at runtime for the Visual C++ compiler language features.
There are also a few auxiliary libraries as well for specific scenarios:
VCCORLIB*.DLL
is used for C++/CX extensions (a.k.a./ZW
)VCAMP140.DLL
is used for C++ AMPVCOMP140.DLL
is used for OpenMPCONCRT*.DLL
is used to implement C++11<thread>
on Windows XP (not used on newer versions of Windows; it's delay loaded if required)
See this blog post and this one.
Essentially the C runtime (the UCRTBASE) part is a simple extern "C"
interface so the ABI is well-defined, and thus is usable with multiple versions of Visual C++ and even other compilers. Exactly which version of the UCRT you are using is therefore primarily depending on the OS and the Windows 10 SDK you are using via WindowsTargetPlatformVersion
. You can applocal deploy UCRT as well per this blog.
The C++ Runtime (MSVCP*.DLL) includes a lot of inlines and exposed memory layouts, and historically there was a breaking change between between Visual C++ versions. That said, for VS 2015 Update 3, VS 2017, and VS 2019 the VC team has made a point of keeping 'binary compatibly' here meaning that if you have a static library that uses C++ std namespace components from a PlatformToolset
of v140/v141, it will successfully link with a later version of Visual C++ up through v142. It's not clear that this will hold in the future, but it is true for this particular set of releases per Microsoft Docs.
The VCRUNTIME*.DLL
needs to match the version of the Visual C++ compiler you are using to build the final link, so this is very much intended to match your PlatformToolset
.
这篇关于哪些提供了C/C ++运行时库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!