-->

Visual Studio 2008的发布版本不装饰的DLL导出(Visual Studio 200

2019-10-17 10:52发布

我建立一个C ++ DLL在Visual Studio 2008中由写入的Borland C ++ Builder的6 C应用程序中使用。

我调试动态链接库构建出口的方法装饰用下划线。 然而,在我的版本的DLL构建方法不是装饰造成C ++ Builder的链接错误。 (参见下面的输出为DUMPBIN.EXE两种生成类型)

我检查了调试和发布配置编译选项并不能看到任何可能会造成这个问题。

我设法得到它解决此问题。 Borland的IMPLIB工具,它的Visual Studio .lib文件转换成C ++ Builder的.lib文件,可以添加下划线。 但我想明白为什么出口没有被装饰。

头文件methods.h

#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程序

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

DUMPBIN.EXE输出发布版本

DUMPBIN / EXPORTS Encryption.dll程序

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

Answer 1:

这里是有关项目的调用约定和名称修饰 。 名字装饰可以通过在项目中的* .DEF文件被推翻。



文章来源: Visual Studio 2008 release build not decorating DLL exports