它有多么坏的混搭VC ++运行时DLL的一个过程? [英] How bad is it to mix and match vc++ runtime dlls in one process?

查看:124
本文介绍了它有多么坏的混搭VC ++运行时DLL的一个过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内建的Visual Studio 2012的应用程序,从而取决于 MSVCP110.DLL MSVCR110.DLL 。我在使用其他DLL,这似乎已建成使用Visual Studio 2010和依赖于 MSVCP100.DLL MSVCR100.DLL 。然而,另一个DLL我已经是建立与Visual Studio 2008和依赖于 MSVCR90.DLL

I have an application that is built with visual studio 2012, and thus depends on MSVCP110.DLL and MSVCR110.DLL. I'm using another dll, which seems to have been built with visual studio 2010, and depends on MSVCP100.DLL and MSVCR100.DLL. Yet another DLL I have was build with visual studio 2008 and depends on MSVCR90.DLL.

这是一件坏事?一个非常糟糕的事情吗?我应该担心吗?我想问的原因是,运行时堆分配器抱怨堆损坏。难道这会涉及到混合运行时版本?

Is this a bad thing? A really bad thing? Should I be worried? The reason I ask is that the runtime heap allocator is complaining about heap corruption. Could this be related to the mixed runtime versions?

推荐答案

这不是安全的混合和匹配不同的编译器版本的Visual Studio运行时间,主要是因为每个运行时会创建自己的独立堆。由于堆将是完全独立的,你不能分配使用1堆内存和释放它在不同的堆。这样做会损坏您的堆。腐败通常不会导致立即崩溃,因为堆的损坏部分可能无法在未来数分配或取消分配进行访问,因此它可以是很困难的调试。

It's not safe to mix and match Visual Studio runtimes from different compiler versions mainly because each runtime will create its own independent heap. Since the heaps will be totally independent you can not allocate memory using 1 heap and free it in a different heap. Doing so will corrupt your heaps. The corruption does not usually cause an immediate crash since the corrupt part of the heap may not be accessed on the next few allocations or deallocations so it can be very hard to debug.

有关具有不同的堆比是可能的解决该问题的一个非常有限的方式应用的单个DLL的情况下。你将不得不在DLL隔离,使得DLL的所有分配和释放只发生在DLL里面。并且还隔离会去其他的方式为好。的DLL将不能够从一个应用安全地自​​由存储器不分离

For the case of a single dll having a different heap than the application it is possible to work around the problem in a very limited way. You would have to isolate the dll such that all allocations and deallocations of dll happens only inside of the dll. And also isolation would have to go the other way as well. The dll will not be able to safely free memory from the applicaton without isolation.

这是造成混合版本的CRT堆损坏更多信息可以在这里找到:
<一href=\"http://siomsystems.com/mixing-visual-studio-versions/\">http://siomsystems.com/mixing-visual-studio-versions/

More info on heap corruption caused by mixing CRT versions can be found here: http://siomsystems.com/mixing-visual-studio-versions/

这篇关于它有多么坏的混搭VC ++运行时DLL的一个过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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