[Zlib-devel] 1.2.5 DLL broken?

jbowler at acm.org jbowler at acm.org
Sun Jun 19 16:11:20 EDT 2011


From:	Stephen Howe <stephen.howe at kantarmedia.com>
>I tried using the recently released ZLIB1.DLL version 1.2.5 with Visual Studio 2008 (C++)

It only works with Visual Studio 2010

>causes memory protection faults and the program terminates.

If a compiler other than 2010 is used the program will end up with two C runtimes.  Depending on what the app then does with the (in this case) Visual Studio 2008 CRT the app might work or might crash.

>So I am reverting back to the previous ZLIB1.DLL version 1.2.3 I am surprised that few have noticed this (one other peron on scouring the Internet).

Those older versions don't work with Visual Studio 2010.  I believe that none of these versions work with OpenWatcom.

To give more detail: the VS2010 zlib1.dll on the web page isn't compatible with msvcrt.dll, as were all previous versions (because all previous versions were built against msvcrt.dll, not the Visual Studio runtimes.)   Prior to VS 2010 it was possible (or appeared to be possible) to set up a Visual Studio project to link against msvcrt.dll and it would manage to link without including the VS C runtime.  That is no longer true with 2010, at least not with the libpng using programs I tried, hence the problem.

My solution for libpng was to make a libpng DLL that statically links (and does not export) the relevant zlib modules.  I do this for Visual Studio and OpenWatcom.  For Cygwin and Min/GW the build just links with whatever zlib DLL the platform has.  In any case there is no "official" libpng DLL and I find it very difficult to believe that one could be produced that would not result in a never ending stream of bug reports from one or other group of Windows programmers.

John Bowler <jbowler at acm.org>






More information about the Zlib-devel mailing list