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

      • <bdo id='T1zo7'></bdo><ul id='T1zo7'></ul>
    1. <small id='T1zo7'></small><noframes id='T1zo7'>

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

      <tfoot id='T1zo7'></tfoot>

        C++ DLL 导出:修饰/损坏的名称

        C++ DLL Export: Decorated/Mangled names(C++ DLL 导出:修饰/损坏的名称)

          <legend id='7Jqgt'><style id='7Jqgt'><dir id='7Jqgt'><q id='7Jqgt'></q></dir></style></legend>

              <bdo id='7Jqgt'></bdo><ul id='7Jqgt'></ul>

              <small id='7Jqgt'></small><noframes id='7Jqgt'>

                  <tbody id='7Jqgt'></tbody>
                1. <i id='7Jqgt'><tr id='7Jqgt'><dt id='7Jqgt'><q id='7Jqgt'><span id='7Jqgt'><b id='7Jqgt'><form id='7Jqgt'><ins id='7Jqgt'></ins><ul id='7Jqgt'></ul><sub id='7Jqgt'></sub></form><legend id='7Jqgt'></legend><bdo id='7Jqgt'><pre id='7Jqgt'><center id='7Jqgt'></center></pre></bdo></b><th id='7Jqgt'></th></span></q></dt></tr></i><div id='7Jqgt'><tfoot id='7Jqgt'></tfoot><dl id='7Jqgt'><fieldset id='7Jqgt'></fieldset></dl></div>
                  <tfoot id='7Jqgt'></tfoot>
                  本文介绍了C++ DLL 导出:修饰/损坏的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  使用模块定义文件 (MyDLL.def) 创建基本的 C++ DLL 并导出名称.编译后,我使用 dumpbin.exe 检查导出的函数名称我希望看到:

                  Created basic C++ DLL and exported names using Module Definition file (MyDLL.def). After compilation I check the exported function names using dumpbin.exe I expect to see:

                  SomeFunction
                  

                  但我看到的是这个:

                  SomeFunction = SomeFunction@@@23mangledstuff#@@@@
                  

                  为什么?

                  导出的函数看起来没有修饰(特别是与不使用 Module Def 文件相比),但是其他东西怎么了?

                  The exported function appears undecorated (especially compared to not using the Module Def file), but what's up with the other stuff?

                  如果我对来自任何商业应用程序的 DLL 使用 dumpbin.exe,你会得到干净的:

                  If I use dumpbin.exe against a DLL from any commercial application, you get the clean:

                  SomeFunction
                  

                  没有别的...

                  我还尝试删除模块定义并使用C"样式的导出来导出名称,即:

                  I also tried removing the Module Definition and exporting the names using the "C" style of export, namely:

                  extern "C" void __declspec(dllexport) SomeFunction();
                  

                  (仅使用externC"并没有创建导出函数)

                  (Simply using "extern "C" did not create an exported function)

                  但是,这仍然会创建相同的输出,即:

                  However, this still creates the same output, namely:

                  SomeFunction = SomeFunction@@@23mangledstuff#@@@@
                  

                  我还尝试了 #define dllexport __declspec(dllexport) 选项并创建了一个没有问题的 LIB.但是,我不想向在 C# 应用程序中使用 DLL 的人提供 LIB 文件.

                  I also tried the #define dllexport __declspec(dllexport) option and created a LIB with no problem. However, I don't want to have to provide a LIB file to people using the DLL in their C# application.

                  这是一个普通的 C++ DLL(非托管代码),用 C++ 编译,只有一个简单的头文件和代码.如果没有 Module Def ,我的导出函数会被破坏(我可以创建一个静态库并使用 LIB 没问题.我试图避免这种情况).如果我使用 extern "C" __declspec(dllexport) OR 一个模块定义,我得到的似乎是一个未修饰的函数名......唯一的问题是它被遵循由="和看起来像函数的装饰版本的东西.我想摆脱="之后的东西 - 或者至少了解它为什么在那里.

                  It's a plain vanilla C++ DLL (unmanaged code), compiled with C++ nothing but a simple header and code. Without Module Def I get mangled exported functions (I can create a static library and use the LIB no problem. I'm trying to avoid that). If I use extern "C" __declspec(dllexport) OR a Module Definition I get what appears to be an undecorated function name... the only problem is that it is followed by an "=" and what looks like a decorated version of the function. I want to get rid of the stuff after the "=" - or at least understand why it is there.

                  就目前而言,我非常确定我可以使用 P/Invoke 从 C# 调用该函数……我只想避免="末尾的垃圾.

                  As it stands, I'm pretty certain that I can call the function from C# using a P/Invoke... I just want to avoid that junk at the end of the "=".

                  我愿意接受有关如何更改项目/编译器设置的建议,但我只是使用了标准的 Visual Studio DLL 模板 - 没什么特别的.

                  I'm open to suggestions on how to change the project/compiler settings, but I just used the standard Visual Studio DLL template - nothing special.

                  推荐答案

                  您可以通过关闭调试信息生成来获得您想要的.项目 + 属性、链接器、调试、生成调试信息 = 否.

                  You can get what you want by turning off debug info generation. Project + Properties, Linker, Debugging, Generate Debug Info = No.

                  当然,您只想为发布版本执行此操作.选项已经设置为这种方式.

                  Naturally, you only want to do this for the Release build. Where the option is already set that way.

                  这篇关于C++ 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?)

                      • <bdo id='94fbk'></bdo><ul id='94fbk'></ul>

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

                          <small id='94fbk'></small><noframes id='94fbk'>

                            <tfoot id='94fbk'></tfoot>
                              <tbody id='94fbk'></tbody>
                          1. <legend id='94fbk'><style id='94fbk'><dir id='94fbk'><q id='94fbk'></q></dir></style></legend>