0

I'm building zlib from source using Visual Studio 2012. Note, I didn't tag zlib here simply because I don't think the question is specific to any given project.

The build succeeds but when I use dumpbin /EXPORTS the output looks like this:

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

However, when I examine a version someone else built (using VC6 - not sure if that matters), the output looks like:

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

I'm having problems finding the visual studio setting that changes this output type. Next I tried just changing the .def file from

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

VERSION     1.2

EXPORTS
        adler32                                   @1

to

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

VERSION     1.2

EXPORTS
        _adler32=adler32                          @1

But that appears to simply rename the export so instead of getting:

ordinal hint RVA      name

      1    0 00001000 adler32 = _adler32

I get:

ordinal hint RVA      name

      1    0 00001000 _adler32

and if you switch them around in the .def file, the project doesn't build/link correctly(makes sense).

So is there a setting in newer (than VC6) versions of VS that give /EXPORTS in the format somefunc=_somefunc?

kinar
  • 319
  • 5
  • 17

1 Answers1

1

According to this answer (C++ DLL Export: Decorated/Mangled names), they must have used Generate Debug Info = Yes

Vlad Feinstein
  • 7,028
  • 1
  • 8
  • 18
  • Perfect. Thanks. I searched forever looking for this answer (even here) but had no idea what terms to use. – kinar Nov 22 '19 at 22:34