0%

dumpbin 查看 DLL 导出信息

dumpbin 是 vs 提供的一个工具,可以用于查看 dll/exe 的信息,32 位还是 64 位, 导出函数等

https://blog.csdn.net/luoyu510183/article/details/93666808

如果导入 dll 时发现没有找到该函数, 要根据 dll 的导出约定方式设置对应的导入方式, 否则虽然函数名一样但实际上符号是不同的.

1
dumpbin /exports xxx.dll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#pragma once

extern "C" {
//extern "C" + _stdcall,函数导出符号为 _CreateNativeManager@0 : _+函数名+@+传参字节数
//由于_stdcall是被调用方清理堆栈, 所以函数符号里面包含了传参的信息
_declspec(dllexport) NativeManager* _stdcall CreateNativeManager();
_declspec(dllexport) void _stdcall ReleaseNativeManager();
_declspec(dllexport) void(_stdcall ExSetLogHandler)(LogHandler handler);
//extern "C" + _cdecl,函数导出符号为 ReleaseNativeManager2 : 函数名
//由于_cdecl是调用方清理堆栈, 所以只需要函数名就可以
_declspec(dllexport) void(_cdecl ReleaseNativeManager2)();
}
//不使用extern的情况下, 是C++的导出方式, 函数符号如下:
//?ReleaseNativeManager1@@YGXH@Z : ?+函数名+@@YG+返回类型+参数1类型...+@Z
//如果是_cdecl @YG变为@YA
//如果没有参数即参数为void,则以Z结尾, 例如:
//?ReleaseNativeManager3@@YAXXZ : ?+函数名+@@YA+返回类型+XZ
//以上 X表示 void类型, H表示int参数类型
_declspec(dllexport) void(_stdcall ReleaseNativeManager1)(int num);
_declspec(dllexport) void(_cdecl ReleaseNativeManager3)();