1. <legend id='wzFTl'><style id='wzFTl'><dir id='wzFTl'><q id='wzFTl'></q></dir></style></legend>
  2. <small id='wzFTl'></small><noframes id='wzFTl'>

    <tfoot id='wzFTl'></tfoot>
      <bdo id='wzFTl'></bdo><ul id='wzFTl'></ul>
  3. <i id='wzFTl'><tr id='wzFTl'><dt id='wzFTl'><q id='wzFTl'><span id='wzFTl'><b id='wzFTl'><form id='wzFTl'><ins id='wzFTl'></ins><ul id='wzFTl'></ul><sub id='wzFTl'></sub></form><legend id='wzFTl'></legend><bdo id='wzFTl'><pre id='wzFTl'><center id='wzFTl'></center></pre></bdo></b><th id='wzFTl'></th></span></q></dt></tr></i><div id='wzFTl'><tfoot id='wzFTl'></tfoot><dl id='wzFTl'><fieldset id='wzFTl'></fieldset></dl></div>
    1. 从 MinGW 链接到 MSVC DLL

      时间:2023-09-18

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

                <tbody id='LlLMw'></tbody>
            1. <tfoot id='LlLMw'></tfoot>
                本文介绍了从 MinGW 链接到 MSVC DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在尝试将 LizardTech GeoExpress DSDK 链接到我自己的应用程序中.我使用 gcc 以便我们可以针对平台进行编译.在 Linux 和 Mac 上,这很容易工作:它们提供了一个静态库 (libltidsdk.a) 和头文件,我们所要做的就是使用它们.

                I'm trying to link the LizardTech GeoExpress DSDK into my own application. I use gcc so that we can compile on for platforms. On Linux and Mac this works easily: they provide a static library (libltidsdk.a) and headers and all that we have to do is use them.

                为 Windows 编译并不那么容易.他们使用 Microsoft Visual Studio 构建了库,我们使用 MinGW.我已阅读 MinGW 常见问题解答,但遇到了以下问题.该库全是 C++,所以我的第一个问题是:这甚至可能吗?

                Compiling for windows isn't so easy. They've built the library using Microsoft Visual Studio, and we use MinGW. I've read the MinGW FAQ, and I'm running into the problems below. The library is all C++, so my first question: is this even possible?

                仅根据提供的 dll 链接会产生所有 C++ 调用(构造函数、析构函数、方法等)的未定义引用"错误.

                Just linking against the dll as provided yields "undefined reference" errors for all of the C++ calls (constructors, desctructors, methods, etc).

                基于 MinGW 维基:http://www.mingw.org/wiki/MSVC%5Fand%5FMinGW%5FDLLs我应该能够使用实用程序 reimp 将 .lib 转换为可用的东西.我已经尝试了 LizardTech 提供的所有 .lib 文件,它们都给出了无效或损坏的导入库".我已经尝试了 reimp 实用程序的 0.4 和 0.3 版.

                Based on the MinGW Wiki: http://www.mingw.org/wiki/MSVC%5Fand%5FMinGW%5FDLLs I should be able to use the utility reimp to convert a .lib into something useable. I've tried all of the .lib files provided by LizardTech, and they all give "invalid or corrupt import library". I've tried both version 0.4 and 0.3 of the reimp utility.

                使用 wiki 中描述的第二种方法,我在 dll 上运行 pexport 和 dlltool 以获取 .a 存档,但这会产生相同的未定义引用.

                Using the second method described in the wiki, I've run pexport and dlltool over the dll to get a .a archive, but that produces the same undefined references.

                顺便说一句:我已经阅读了下面的讨论.关于这是否可行,它留下了一些歧义,鉴于 MinGW Wiki 页面,这似乎应该是可行的.如果这是不可能的,那就是我需要知道的全部.如果可以的话,我想知道如何才能做到这一点.

                BTW: I have read the discussion below. It left some ambiguity as to whether this is possible, and given the MinGW Wiki page it seems like this should be doable. If it is impossible, that's all I need to know. If it can be done, I'd like to know how I can get this to happen.

                如何从g++链接到VS2008生成的.libs

                谢谢!

                推荐答案

                你不能这样做.他们从他们的 dll 中导出了 C++ 类,而不是 C 函数.不同之处在于,C++ 函数总是以特定于特定编译器版本的重整形式导出名称.

                You can't do this. They have exported C++ classes from their dll, rather than C-functions. The difference is, c++ functions are always exported with names in a mangled form that is specific to a particular version of the compiler.

                他们的 dll 只能以这种形式被 msvc 使用,甚至可能无法在不同版本的 msvc 之间工作,因为微软之前已经改变了他们的修改方案.

                Their dll is usable by msvc only in that form, and will probably not even work between different versions of msvc, as Microsoft have changed their mangling scheme before.

                如果你有任何筹码,你需要让他们改变他们的邪恶方式.否则,您将需要使用 MSVC 编写一个 shim dll,它将导入所有类,并通过返回接口的 c 函数重新导出它们.

                If you have any leverage, you need to get them to change their evil ways. Otherwise you will need to use MSVC to write a shim dll, that will import all the classes, and re-export them via c functions that return interfaces.

                这篇关于从 MinGW 链接到 MSVC DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:对于不遵循 libNAME.so 命名约定的库,如何在不使 下一篇:使用 -static-libgcc -static-libstdc++ 编译仍然会导致对

                相关文章

                最新文章

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

                <tfoot id='Eb0GJ'></tfoot>
              • <small id='Eb0GJ'></small><noframes id='Eb0GJ'>

                  <bdo id='Eb0GJ'></bdo><ul id='Eb0GJ'></ul>

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