<legend id='Xsf0f'><style id='Xsf0f'><dir id='Xsf0f'><q id='Xsf0f'></q></dir></style></legend>

  1. <i id='Xsf0f'><tr id='Xsf0f'><dt id='Xsf0f'><q id='Xsf0f'><span id='Xsf0f'><b id='Xsf0f'><form id='Xsf0f'><ins id='Xsf0f'></ins><ul id='Xsf0f'></ul><sub id='Xsf0f'></sub></form><legend id='Xsf0f'></legend><bdo id='Xsf0f'><pre id='Xsf0f'><center id='Xsf0f'></center></pre></bdo></b><th id='Xsf0f'></th></span></q></dt></tr></i><div id='Xsf0f'><tfoot id='Xsf0f'></tfoot><dl id='Xsf0f'><fieldset id='Xsf0f'></fieldset></dl></div>
  2. <tfoot id='Xsf0f'></tfoot>
      <bdo id='Xsf0f'></bdo><ul id='Xsf0f'></ul>

    <small id='Xsf0f'></small><noframes id='Xsf0f'>

    1. 在一个进程中混合和匹配 Visual C++ 运行时 DLL 文件

      时间:2023-08-01
        <bdo id='6TYOW'></bdo><ul id='6TYOW'></ul>

          • <small id='6TYOW'></small><noframes id='6TYOW'>

            <tfoot id='6TYOW'></tfoot>

            1. <i id='6TYOW'><tr id='6TYOW'><dt id='6TYOW'><q id='6TYOW'><span id='6TYOW'><b id='6TYOW'><form id='6TYOW'><ins id='6TYOW'></ins><ul id='6TYOW'></ul><sub id='6TYOW'></sub></form><legend id='6TYOW'></legend><bdo id='6TYOW'><pre id='6TYOW'><center id='6TYOW'></center></pre></bdo></b><th id='6TYOW'></th></span></q></dt></tr></i><div id='6TYOW'><tfoot id='6TYOW'></tfoot><dl id='6TYOW'><fieldset id='6TYOW'></fieldset></dl></div>
              • <legend id='6TYOW'><style id='6TYOW'><dir id='6TYOW'><q id='6TYOW'></q></dir></style></legend>
                  <tbody id='6TYOW'></tbody>

              • 本文介绍了在一个进程中混合和匹配 Visual C++ 运行时 DLL 文件有多糟糕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我有一个使用 Visual Studio 2012 构建的应用程序,因此它依赖于 MSVCP110.DLLMSVCR110.DLL.我正在使用另一个 DLL 文件,它似乎是用 Visual Studio 2010 构建的,并且依赖于 MSVCP100.DLLMSVCR100.DLL.我的另一个 DLL 是使用 Visual Studio 2008 构建的,并且依赖于 MSVCR90.DLL.

                I have an application that is built with Visual Studio 2012, and thus it depends on MSVCP110.DLL and MSVCR110.DLL. I'm using another DLL file, 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 版本导致的堆损坏的更多信息,请访问: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/

                编辑(2020 年 4 月 1 日):上面的答案早于 Visual Studio 2015.Visual Studio 2015 到 2019 彼此二进制兼容,但与任何以前的版本都不兼容.

                Edit (April 1, 2020): The answer above predates Visual Studio 2015. Visual Studio 2015 through 2019 are binary compatible with each other but not compatible with any previous version.

                以下链接讨论了这些版本之间的二进制兼容性:https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2019

                The following link discusses the binary compatibility between these versions: https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2019

                这篇关于在一个进程中混合和匹配 Visual C++ 运行时 DLL 文件有多糟糕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在 Windows 控制台中获取按键 下一篇:如何在 WIN32 中找到字符串的宽度(以像素为单位

                相关文章

                最新文章

                1. <i id='FBEfG'><tr id='FBEfG'><dt id='FBEfG'><q id='FBEfG'><span id='FBEfG'><b id='FBEfG'><form id='FBEfG'><ins id='FBEfG'></ins><ul id='FBEfG'></ul><sub id='FBEfG'></sub></form><legend id='FBEfG'></legend><bdo id='FBEfG'><pre id='FBEfG'><center id='FBEfG'></center></pre></bdo></b><th id='FBEfG'></th></span></q></dt></tr></i><div id='FBEfG'><tfoot id='FBEfG'></tfoot><dl id='FBEfG'><fieldset id='FBEfG'></fieldset></dl></div>

                  <small id='FBEfG'></small><noframes id='FBEfG'>

                  • <bdo id='FBEfG'></bdo><ul id='FBEfG'></ul>

                2. <tfoot id='FBEfG'></tfoot>

                    <legend id='FBEfG'><style id='FBEfG'><dir id='FBEfG'><q id='FBEfG'></q></dir></style></legend>