DLL函数名称使用dumpbin.exe [英] DLL function names using dumpbin.exe
问题描述
我在visual studio 2010中编写了一个具有很多功能和类的.dll库。
当我查看文件的内容时:
I have written a .dll library with lots of functions and classes in visual studio 2010. When I look at the content of the file with:
dumpbin.exe /EXPORTS myDll.dll
函数名称具有某种函数位置指针,看起来像这样(.dll中的第二个条目):
I get long function names with some kind of a function location pointer, which looks like this (second entry in .dll):
2 1 0001100A ?Initialize@codec@codecX@@SANNN@Z = @ILT+5(?Initialize@codec@codecX@@SANNN@Z)
这是一个很难看的,但是我看到其他.dll-s的更好的程序/功能列表,如下所示:
This is somehow hard to read, but I saw "nicer" procedure/function list from other .dll-s, like this:
141 8C 00002A08 PogoDbWriteValueProbeInfo
.dll列表看起来像这样?
PS:我的dll源代码如下所示:
namespace codecX
{
class codec
{
public:
static __declspec(dllexport) double Initialize(double a, double b);
...
推荐答案
你需要拉那些静态成员函数进入全局地址空间,然后用
externC包装它们。这将抑制C ++名称的变化,而不是给你C名称变得不那么丑陋:
You need to pull those static member functions into the global address space and then wrap them with extern "C". This will suppress the C++ name mangling and instead give you C name mangling which is less ugly:
extern "C" __declspec(dllexport) Initialize(double a, double b)
{
codec::Initialize(a, b);
}
然后删除静态成员函数上的__declspec(dllexport) p>
and then remove the __declspec(dllexport) on your static member functions:
class codec
{
public:
static double Initialize(double a, double b);
}
这篇关于DLL函数名称使用dumpbin.exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!