ucrtbase.dll
and vcruntime140.dll
overlap in some of the functions they export according to Dependency Walker?Disclaimer: This is currently purely of academic interest to me.
I'm currently trying to understand the layout of the Microsoft Visual-C++ CRT related DLL files. Find Info un the UCRT and the files in general here:
In short, you have these (toplevel) DLL dependencies at runtime for a normal C++ App:
ucrtbase.dll
- "compiler independent" stuffvcruntime<ver>.dll
- "compiler dependent" stuffmsvcp<ver>.dll
- C++ standard libraryWhat can be highlighted from this info is:
From the blog entry:
... split the CRT into two logical parts: The VCRuntime, which contained the compiler support functionality required for things like process startup and exception handling ...
and from the MSDN page:
The vcruntime library contains Visual C++ CRT implementation-specific code, such as exception handling and debugging support, runtime checks and type information, implementation details and certain extended library functions. This library is specific to the version of the compiler used.
While browsing the DLLs with Dependency Walker, I noticed that both the ucrt and the vcruntime export the function _CxxThrowException
. This function is an old acquaintance if you've ever been looking at vc++ stack traces:
Builds the exception record and calls the runtime environment to start processing the exception.
I am quite surprised to find this exported from the ucrtbase.dll
as - as both quotes above indicate - I'd have thought this machinery to firmly belong to the compiler specific side of things.
While writing this up, I've noticed some other overlaps: A very few of the standard C library functions (memcpy
, ..., strstr
, ...) are also exported from vcruntime140.dll
although I'd have expected them to only live in ucrtbase
.
So what is going on here and what can I learn from this?
The Universal CRT (ucrtbase.dll) contains a private copy of the VCRuntime, for use by Windows operating system components. This private copy of the VCRuntime is an internal implementation detail of the operating system and may change at any time (i.e., there is no application compatibility guarantee whatsoever.
Do not under any circumstances use these exports from the Universal CRT. (No library in the Windows SDK provides linkable symbols for these exports, so it's impossible to accidentally use them.)