Microsoft C 运行时中的 msvcp140_1.dll 和 msvcp140_2.dll 文件是什么?

What are the msvcp140_1.dll and msvcp140_2.dll files in the Microsoft C runtime?

我正在尝试将 C 库导入到 Visual Studio 项目中。该库附带以下文件:

msvcp140.dll
msvcp140_1.dll
msvcp140_2.dll

我了解到这些是 Microsoft C 运行时 DLL 文件。但我想更多地了解这些文件的用途。我想知道我需要什么二进制文件以及包含它们会产生什么后果。

msvcp140_1.dllmsvcp140_2.dll 文件的用途是什么?

这些文件实际上是 C++ 标准库实现(请参阅名称中的 p)。来自 CRT Library Features | Microsoft DocsC++ Standard Library 部分:

When you build a release version of your project, one of the basic C run-time libraries (libcmt.lib, msvcmrt.lib, msvcrt.lib) is linked by default, depending on the compiler option you choose (multithreaded, DLL, /clr). If you include one of the C++ Standard Library header files in your code, a C++ Standard Library will be linked in automatically by Visual C++ at compile time. For example:

#include <ios>

For binary compatibility, more than one DLL file may be specified by a single import library. Version updates may introduce dot libraries, separate DLLs that introduce new library functionality. For example, Visual Studio 2017 version 15.6 introduced msvcp140_1.dll to support additional standard library functionality without breaking the ABI supported by msvcp140.dll. The msvcprt.lib import library included in the toolset for Visual Studio 2017 version 15.6 supports both DLLs, and the vcredist for this version installs both DLLs. Once shipped, a dot library has a fixed ABI, and will never have a dependency on a later dot library.

由于 Microsoft 的 C++ 标准库是开源的,您可以轻松地查找这些附加功能是什么,例如stl/CMakeLists.txt 甚至描述文件:

# msvcp140_1.dll (the memory_resource satellite)

# msvcp140_2.dll (the special math satellite)

但是 the source filenames 本身已经具有描述性。