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

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

问题描述

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





编译后,我运行

  dumpbin / symbols DLLTest.dll 

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





我跑了

  dumpbin / all DLLTest.dll 

(带有文本输出选项),​​但是我在输出中找不到修饰的函数名称(我搜索了 int getSomeNum 应该是在输出转储中装饰名称)。



我也试图找到一种方法在VS2013中将/ FAs输入到编译器选项中,但是我无法可以在项目的C / C ++属性页中找到编译器选项。



如果能找到修饰后的函数名称,我将不胜感激。



编辑:感谢指针,杰斯特。我已经修改了原始代码





但是,重新编译后, bumpbin仍未显示任何修饰名称(使用/ symbols选项)。

解决方案

尝试 dumpbin / exports DLLTest.dll 。我已经尝试过自己:

 >类型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;
}
返回TRUE;
}

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

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

__declspec(dllexport)int getSomeNum2()
{
返回5;
}
> cl / LD dlltest.cpp
dlltest.cpp
Microsoft(R)增量链接程序版本12.00.30501.0
版权所有(C)Microsoft Corporation。版权所有。

/out:dlltest.dll
/ dll
/implib:dlltest.lib
dlltest.obj
dlltest.lib라이브러리및dlltest.exp개체 。다。
> dumpbin / exports dlltest.dll
Microsoft(R)COFF / PE Dumper版本12.00.30501.0
版权所有(C)Microsoft Corporation。版权所有。


dlltest.dll

文件类型:DLL

该节包含dlltest.dll $ b $的以下导出b
00000000特性
53C91AAE时间戳2014年7月18日星期五22:01:34
0.00版本
1序数基数
2函数数
2名称数量

顺序提示RVA名称

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

摘要

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


I created a dll project in Visual Studio 2013

After compiling, I run

dumpbin /symbols DLLTest.dll

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

I ran

 dumpbin /all DLLTest.dll 

(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).

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.

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

However, after recompilation bumpbin is still not showing any decorated name (with the /symbols option).

解决方案

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天全站免登陆