C++ Visual Studio 2008发行版未装饰DLL导出
我在Visual Studio 2008中构建了一个C++ DLL,它由Borland C++ Builder 6中编写的C应用程序使用。p> 我的调试DLL生成导出用下划线修饰的方法。但是,在我的发行版DLL构建中,这些方法没有被修饰,导致C++生成器中的链接错误。(有关两种生成类型的dumpbin.exe的输出,请参见下文) 我已经检查了调试和发布配置的编译器选项,看不到可能导致此问题的任何内容 我设法解决了这个问题。Borland工具EnimIB,它将VisualStudio.LIB文件转换成C++ Builder .LIB文件,可以添加下划线。但我想了解为什么出口商品没有被装饰 头文件方法.hC++ Visual Studio 2008发行版未装饰DLL导出,c++,visual-studio-2008,dll,dllexport,C++,Visual Studio 2008,Dll,Dllexport,我在Visual Studio 2008中构建了一个C++ DLL,它由Borland C++ Builder 6中编写的C应用程序使用。p> 我的调试DLL生成导出用下划线修饰的方法。但是,在我的发行版DLL构建中,这些方法没有被修饰,导致C++生成器中的链接错误。(有关两种生成类型的dumpbin.exe的输出,请参见下文) 我已经检查了调试和发布配置的编译器选项,看不到可能导致此问题的任何内容 我设法解决了这个问题。Borland工具EnimIB,它将VisualStudio.LIB文件转
#ifndef METHODS_H
#define METHODS_H
#ifdef ENCRYPTION_EXPORTS
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
DLLEXPORT BOOL EncryptString(char *szPlain, char *szEncrypted);
DLLEXPORT BOOL DecryptString(char *szEncrypted, char *szPlain);
DLLEXPORT BOOL EncryptInitialise(void);
DLLEXPORT void EncryptExit(void);
#ifdef __cplusplus
}
#endif
#endif
调试生成的Dumpbin.exe输出
dumpbin/EXPORTS encryption.dll
发布版本的Dumpbin.exe输出
dumpbin/EXPORTS encryption.dll
这里有一篇关于。名称修饰可能会被项目中的*.def文件否决。这里有一篇关于。项目中的*.def文件可能会推翻名称修饰。调试版本会显示更多信息,因为dumpbin.exe可以读取.pdb文件。很明显,导出已从其主要下划线版本重命名。这是由.def文件完成的,请将其删除。确实有点想知道它是从哪里来的,它们不是偶然出现的。没有.def文件,也从来没有出现过。我只能使用MSDN上记录的dllexport方法。调试版本会显示更多信息,因为dumpbin.exe可以读取.pdb文件。很明显,导出已从其主要下划线版本重命名。这是由.def文件完成的,请将其删除。确实有点想知道它是从哪里来的,它们不是偶然出现的。没有.def文件,也从来没有出现过。我只能使用MSDN上记录的dllexport方法
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file encryption.dll
File Type: DLL
Section contains the following exports for encryption.dll
00000000 characteristics
50B8B22E time date stamp Fri Nov 30 13:18:38 2012
0.00 version
1 ordinal base
4 number of functions
4 number of names
ordinal hint RVA name
1 0 000308F7 DecryptString = @ILT+2290(_DecryptString)
2 1 00031635 EncryptExit = @ILT+5680(_EncryptExit)
3 2 000303CF EncryptInitialise = @ILT+970(_EncryptInitialise)
4 3 0003003C EncryptString = @ILT+55(_EncryptString)
Summary
5000 .data
1000 .idata
13000 .rdata
5000 .reloc
1000 .rsrc
64000 .text
2F000 .textbss
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file encryption.dll
File Type: DLL
Section contains the following exports for encryption.dll
00000000 characteristics
50B8BE14 time date stamp Fri Nov 30 14:09:24 2012
0.00 version
1 ordinal base
4 number of functions
4 number of names
ordinal hint RVA name
1 0 00001A10 DecryptString
2 1 000012C0 EncryptExit
3 2 00001370 EncryptInitialise
4 3 00001820 EncryptString
Summary
4000 .data
4000 .rdata
2000 .reloc
1000 .rsrc
F000 .text