在 dll 中找不到修饰的函数名称 [英] Cannot find decorated function name in dll

查看:25
本文介绍了在 dll 中找不到修饰的函数名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2013 中创建了一个 dll 项目

I created a dll project in Visual Studio 2013

编译后运行

dumpbin /symbols DLLTest.dll

通过dll所在目录的cmd.exe,但是我只得到了摘要

via cmd.exe in the directory where the dll is located, but I only get the summary

我跑了

 dumpbin /all DLLTest.dll 

(带有文本输出选项)但我在输出中找不到修饰的函数名称(我搜索了 intgetSomeNum 应该是 intgetSomeNum 的一部分输出转储中的 href="http://msdn.microsoft.com/en-us/library/2ax8kbk1.aspx" rel="nofollow noreferrer">装饰名称).

(with the text output option) but I could not find the decorated function name in the output (I searched for int and getSomeNum that should be part of the decorated name in the output dump).

我也尝试过在VS2013中找到在编译器选项中输入/FAs的方法,但是在项目的C/C++属性页中找不到编译器选项.

I also tried to find a way in VS2013 to enter /FAs into the compiler options, but I was unable to find the compiler options in the C/C++ property pages of the project.

如果您能帮助我识别修饰的函数名称,我将不胜感激.

I would appreciate any help to identify the decorated function names.

谢谢你的指点,小丑.我修改了原代码

Thanks for the pointer, Jester. I have modified the original code

但是,重新编译后bumpbin 仍然没有显示任何修饰的名称(使用/symbols 选项).

推荐答案

尝试 dumpbin/exports DLLTest.dll.我自己试过了:

Try dumpbin /exports DLLTest.dll. I've tried myself:

> type dlltest.cpp
#include <windows.h>

BOOL WINAPI DllMain(HINSTANCE hInst, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_PROCESS_DETACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
        break;
    }
    return TRUE;
}

__declspec(dllexport) int getSomeNum(int a);
__declspec(dllexport) int getSomeNum2();

__declspec(dllexport) int getSomeNum(int a)
{
    return 2 * a;
}

__declspec(dllexport) int getSomeNum2()
{
    return 5;
}
> cl /LD dlltest.cpp
dlltest.cpp
Microsoft (R) Incremental Linker Version 12.00.30501.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:dlltest.dll 
/dll 
/implib:dlltest.lib 
dlltest.obj 
   dlltest.lib 라이브러리 및 dlltest.exp 개체를 생성하고 있습니다.
> dumpbin /exports dlltest.dll
Microsoft (R) COFF/PE Dumper Version 12.00.30501.0
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file dlltest.dll

File Type: DLL

  Section contains the following exports for dlltest.dll

    00000000 characteristics
    53C91AAE time date stamp Fri Jul 18 22:01:34 2014
        0.00 version
           1 ordinal base
           2 number of functions
           2 number of names

    ordinal hint RVA      name

          1    0 00001030 ?getSomeNum2@@YAHXZ
          2    1 00001020 ?getSomeNum@@YAHH@Z

  Summary

        3000 .data
        5000 .rdata
        1000 .reloc
        B000 .text

这篇关于在 dll 中找不到修饰的函数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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