[Zlib-devel] Fwd: zlib app crashes on release, not debug in Visual C++

jbowler at acm.org jbowler at acm.org
Wed Aug 4 23:47:21 EDT 2010


>Below is an archive that contains the implib in two versions: one built
with
>VS2010 (built by Gilles and sent to us in one of his earlier emails), the
other
>one built by MinGW but with the 'strip' command executed after the build. 

I verified that I could still reproduce the failure with the original
zdll.lib - I could, then I simply copied each of the two new zdll.libs on
top of the original and rebuilt:

zdll-mingwstrip: build fails:

1>ClCompile:
1>  stdafx.cpp
1>  zlibtest.cpp
1>zlibtest.obj : error LNK2001: unresolved external symbol _zlibVersion
1>G:\cygwin\home\jbowler\vstudio\zlibtest\Release\zlibtest.exe : fatal error
LNK1120: 1 unresolved externals

zdll-vs2010: build succeeded, execution succeeds.

To make sure I was correct I copied back the original zdll.lib (on top of
what was now the zdll-vs2010 version), rebuilt, retested and got the
expected failure, then copied and repeated with vs2010 and got successful
execution.

I used Cygwin ar to examine the contents of both libraries.  The MinGW one
contains a series of COFF object modules, apparently one for each entry
point.  The Microsoft one contains three COFF modules at the start, however
the remainder are simply chunks of data.  These files are all about 40 bytes
long and consist of 20 bytes of numbers followed by the null terminated name
of the entry point followed by the null terminated name of the DLL
(zlib1.dll).  Presumably that data is understood by the Microsoft linker.

John Bowler <jbowler at acm.org>






More information about the Zlib-devel mailing list