Visual Studio 链接器设置以 someFunction = _someFunction 格式生成导出名称(“=”是关键)

What Visual Studio linker settings produces export names in the format someFunction = _someFunction ( the "=" being the key)

我正在使用 Visual Studio 2012 从源代码构建 zlib。请注意,我没有在这里标记 zlib 只是因为我认为这个问题不是特定于任何给定项目的。

构建成功,但是当我使用 dumpbin /EXPORTS 时,输出如下所示:

C:\Source\zlib>dumpbin /EXPORTS ./zlib1.dll
Microsoft (R) COFF/PE Dumper Version 11.00.61232.400
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file ./zlib1.dll

File Type: DLL

  Section contains the following exports for zlib1.dll

    00000000 characteristics
    5DD6A00D time date stamp Thu Nov 21 08:32:45 2019
        0.00 version
           1 ordinal base
         165 number of functions
         119 number of names

    ordinal hint RVA      name

          1    1 00001000 adler32
        140    2 00001340 adler32_combine
          2    3 00001410 compress
         39    4 00001360 compress2
         46    5 00001430 compressBound

但是,当我检查别人构建的版本时(使用 VC6 - 不确定这是否重要),输出如下:

C:\Source\zlib-1.2.7-win32>dumpbin /EXPORTS ./zlib1.dll
Microsoft (R) COFF/PE Dumper Version 11.00.61232.400
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file ./zlib1.dll

File Type: DLL

  Section contains the following exports for zlib1.dll

    00000000 characteristics
    509EFCCB time date stamp Sat Nov 10 19:18:03 2012
        0.00 version
           1 ordinal base
          76 number of functions
          76 number of names

    ordinal hint RVA      name

          1    0 00001000 adler32 = _adler32
          2    1 00001270 adler32_combine = _adler32_combine
          3    2 00001340 adler32_combine64 = _adler32_combine64
          4    3 00001400 compress = _compress
          5    4 00001360 compress2 = _compress2
          6    5 00001420 compressBound = _compressBound

我在查找更改此输出类型的 visual studio 设置时遇到问题。接下来,我尝试将 .def 文件从

LIBRARY
; zlib data compression and ZIP file I/O library

VERSION     1.2

EXPORTS
        adler32                                   @1

LIBRARY
; zlib data compression and ZIP file I/O library

VERSION     1.2

EXPORTS
        _adler32=adler32                          @1

但这似乎只是重命名导出,而不是得到:

ordinal hint RVA      name

      1    0 00001000 adler32 = _adler32

我得到:

ordinal hint RVA      name

      1    0 00001000 _adler32

并且如果您在 .def 文件中切换它们,项目不会 build/link 正确(有意义)。

那么在 VS 的较新版本(比 VC6)中是否有一个设置以 somefunc=_somefunc 格式给出 /EXPORTS?

根据这个回答(C++ DLL Export: Decorated/Mangled names),他们肯定用过Generate Debug Info = Yes