哪些提供了C/C ++运行时库? [英] What provids C/C++ runtime libraries?

查看:57
本文介绍了哪些提供了C/C ++运行时库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于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 ++,请使用

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 well C:\Program Files (x86)\Windows Kits\10\Source\<version>\ucrt.

  • MSVCP*.DLL This is the "C++ Runtime" library, basically stuff like std::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++ AMP

  • VCOMP140.DLL is used for OpenMP

  • CONCRT*.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆