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

1

6

I am trying to import a C library into a Visual Studio project. The library ships with the following files:

msvcp140.dll
msvcp140_1.dll
msvcp140_2.dll

I understand that these are Microsoft C runtime DLL files. But I'd like to know more about the purpose of those files. I'd like to know what binaries I need and what consequence including them has.

What is the purpose of the msvcp140_1.dll and msvcp140_2.dll files?

Iroquoian answered 25/5, 2020 at 10:37 Comment(1)
C++, not C. Five years ago Microsoft released msvcp140.dll and promised to keep it binary-compatible with future releases. That was a very welcome and popular promise, but the C++ committee did not stop adding features. msvcp140_1 takes care of operator new(size_t, align_val_t), msvcp140_2 covers the added special math functions in cmath.Spin
H
10

Those files are actually the C++ Standard Library implementation (see the p in their name). From the C++ Standard Library section on CRT Library Features | Microsoft Docs:

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.

Since Microsoft's C++ Standard Library is open-source you can easily look up what those additional features are, e.g. stl/CMakeLists.txt even describes the files:

# msvcp140_1.dll (the memory_resource satellite)

and

# msvcp140_2.dll (the special math satellite)

However the source filenames are already descriptive on their own.

Hygrograph answered 25/5, 2020 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.