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

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

        <bdo id='zqcun'></bdo><ul id='zqcun'></ul>
    1. <tfoot id='zqcun'></tfoot>

        如何静态链接 .DLL?

        How to link a .DLL statically?(如何静态链接 .DLL?)
            <tbody id='pu3OW'></tbody>
          <i id='pu3OW'><tr id='pu3OW'><dt id='pu3OW'><q id='pu3OW'><span id='pu3OW'><b id='pu3OW'><form id='pu3OW'><ins id='pu3OW'></ins><ul id='pu3OW'></ul><sub id='pu3OW'></sub></form><legend id='pu3OW'></legend><bdo id='pu3OW'><pre id='pu3OW'><center id='pu3OW'></center></pre></bdo></b><th id='pu3OW'></th></span></q></dt></tr></i><div id='pu3OW'><tfoot id='pu3OW'></tfoot><dl id='pu3OW'><fieldset id='pu3OW'></fieldset></dl></div>

            • <small id='pu3OW'></small><noframes id='pu3OW'>

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

                • <legend id='pu3OW'><style id='pu3OW'><dir id='pu3OW'><q id='pu3OW'></q></dir></style></legend>
                • <tfoot id='pu3OW'></tfoot>

                  本文介绍了如何静态链接 .DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我们有一个由 VS 构建的(纯原生 C++).DLL.作为客户端,我们有一些本地 C++ 应用程序和一个围绕这个 DLL 的 .Net-Wrapper,用 C++/CLI 编写.最后,还有一些用 C# 编写的 .Net-Wrapper 客户端应用程序.

                  We have a (pure native C++) .DLL that is build by VS. As clients we have some native C++ applications and a .Net-Wrapper around this DLL written in C++/CLI. Finally there are some client applications for the .Net-Wrapper written in C#.

                  我的问题是 native.dll 必须以与 .Net 世界不同的方式分发,并且 VS 不跟踪该 DLL.因此,为了让我所有的 C# 应用程序正常工作,我必须将它复制到每个可执行目录或将它放在 %PATH% 中的某个位置(我会在开发人员计算机上避免这样做,因为他们可能想要使用不同版本的 DLL 启动不同的应用程序).如果存在引用 Wrapper-DLL 的 UserControl,则会出现更大的问题:您必须将 DLL 复制到 VS 的目录或再次复制到 %PATH%.但最坏的情况发生在我们的翻译工具上.该工具跟踪 .Net-Assemblies 并将它们打包到可以发送给外部翻译器的 Translator-packages 中.据我所知,无法将本机 .DLL 放入该包中!

                  My problem is that the native.dll must be distributed in a different way than the .Net world works and the VS does not keeps track of that DLL. So to let all my C# Apps work correctly I have to copy it to each executable directory or put it somwhere in %PATH% (which I would avoid on developer computers since they may want to start different apps with different versions of the DLL). Even bigger problems occur if there are UserControls that reference the Wrapper-DLL: You have to copy the DLL to VS's directory or again to %PATH%. But the worst case occurs with our Translator tool. This tool keeps track of .Net-Assemblies and packs them into Translator-packages that can be send to an external translator. As far as I know there is no way to put the native .DLL into that package!

                  所以我计划将本机 DLL 静态链接到 .Net-Wrapper,这将解决我的问题.但是对于我们的本机应用程序,这个本机 DLL 仍然必须是一个 DLL.

                  So I plan to link the native DLL statically into the .Net-Wrapper which would solve my problems. But for our Native applications this native DLL must still be a DLL.

                  所以我有两个选择:

                  • 制作两个项目(一个生成静态库;一个创建动态库 => 我尽量避免这种情况)
                  • 找到静态链接 DLL 的解决方案
                  • 找到一种方法让 VS 从一个项目生成两个输出

                  推荐答案

                  在 dll 的 C++ 项目文件中,创建两个配置,一个生成 DLL,一个生成 .lib.两个项目不是必需的,因为任何 .NET/C++ 项目都可以支持多个构建配置(这就是 Release 和 Debug 版本构建的不同方式).

                  In the C++ project file for the dll, create two configurations, one that generates a DLL and one that generates a .lib. Two projects are not necessary, since any .NET/C++ project can support multiple build configurations (this is how Release and Debug versions build differently).

                  这篇关于如何静态链接 .DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
                  How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                  Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                  Delay Loading DLLs(延迟加载 DLL)
                  Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                  Loading a dll from a dll?(从 dll 加载 dll?)
                • <tfoot id='pgmG4'></tfoot>

                      • <legend id='pgmG4'><style id='pgmG4'><dir id='pgmG4'><q id='pgmG4'></q></dir></style></legend>

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

                          <tbody id='pgmG4'></tbody>

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

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