正在加载MS正式支持的MSVCR(或UCRT等)的版本和调试版本? [英] Is loading both release and debug version of MSVCR (or UCRT etc.) officially supported by MS?

查看:434
本文介绍了正在加载MS正式支持的MSVCR(或UCRT等)的版本和调试版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您链接到 MS Visual C运行时库从您的(C ++)程序中,通常只能链接到一个版本,发行版或调试版本: MSVCR< ver> .dll MSVCR< ver> D.dll 与VS2015 ucrtbase [D] .dll s及其附加依赖关系。

When you link to the MS Visual C Runtime Library from your (C++) program, you normally only link against one version, the release or debug version: Either MSVCR<ver>.dll or MSVCR<ver>D.dllor with VS2015 the ucrtbase[D].dlls and their additional dependencies.

免责声明:将他们的使用和将指针(等)交换到另一个将导致崩溃和精神错乱 - 这不是

Disclaimer: Mixing their usage and exchanging pointers (etc.) from one to the other will lead to crashes and insanity -- this is not what this question is about.

但是,当您的C或C ++程序链接到仅在发行版本中提供的第三方(C)DLL时,并且该DLL在内部使用MSVCR (!),即使您在调试版本中运行程序,它也将链接并加载发行版本。 (这样做的一个变体是,第三方lib可以再次内部也使用完全不同于您的MSVCR ###。dll版本,在这种情况下,即使在发布版本中它们也会有差异

However, when your C or C++ program links to a 3rd party (C) DLL that is only delivered in a release variant, and that DLL uses MSVCR internally(!), it will link to and load the release version, even when you run your program in the debug version. (A variant of this is that the 3rd party lib could, again internally, also use a completely different MSVCR###.dll version than you, in which case they'd differ even in your release build.

这是一个非常标准的场景,我一直认为这个只是工作(这确实是

This is a pretty standard scenario for me, and I always assumed that this "just works" (which indeed it seems it does).

我一直在想,这是否实际上是这些MS图书馆的预期和支持的场景?是吗?有什么相反的经验?

I've been wondering however, whether this is actually an expected and supported scenario for these MS libraries? Is it? Any experiences to the contrary?

推荐答案

是的,这是支持的,很常见。

Yes, this is supported, and is common.

您构建一个C ++ / CLI Windows窗体应用程序,您可能最终将至少三个不同的CRT加载到该过程中:您的程序将使用msvcr.dll,CLR将使用msvcr120_clr0400.dll以及加载到您的进程可能使用msvcrt.dll。

For example, if you build a C++/CLI Windows Forms app, you'll probably end up loading at least three different CRTs into the process: your program will use msvcr.dll, the CLR will use msvcr120_clr0400.dll, and various operating system components loaded in your process may use msvcrt.dll.

这篇关于正在加载MS正式支持的MSVCR(或UCRT等)的版本和调试版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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