[Zlib-devel] Fwd: zlib app crashes on release, not debug in Visual C++
Stefan Fuhrmann
stefanfuhrmann at alice-dsl.de
Tue Aug 3 12:07:08 EDT 2010
Mark Adler wrote:
> Perhaps someone can respond to this. Thanks.
>
> Mark
>
>
> Begin forwarded message:
>
>> From: Tilman Hausherr <tilman at snafu.de>
>> Date: August 3, 2010 4:31:41 AM PDT
>> To: zlib at gzip.org
>> Cc: Tilman Hausherr <tilman at snafu.de>
>> Subject: zlib app crashes on release, not debug in Visual C++
>>
>> Hello,
>>
>> I've built a mini console application with Visual C++ 6 that uses the
>> zlib1.dll (1.2.5) http://zlib.net/zlib125-dll.zip that does nothing
>> except calling zlibVersion(). It crashes in release mode with an access
>> violation, but not in debug mode. I can run it in release mode if I
>> enable the /debug linker flag.
>>
>> It gets even weirder:
>> I have found an older zdll.lib at
>> http://www.codeproject.com/KB/files/PdfDigiPad.aspx that is from
>> 24.5.2005, and has a size of 11KB (the current one has a size of 39KB).
>> With the old lib it works in debug *and* release mode...
>>
>> It also works if I use
>> http://www.winimage.com/zLibDll/zlib125dll.zip
>> and then use zlibwapi.lib with ZLIB_WINAPI defined.
>>
>> I did RTFM and found no clue :-(
>> What's my mistake?
>>
>> Tilman
>>
The reason behind these problems is simple:
the DLL must not depend on compiler specific DLLs.
This first one does (MSVCRT.DLL), the last one doesn't.
So, http://zlib.net/zlib125-dll.zip is at least not compatible
with older MS compilers and / or other debug / release
settings because the runtime libs clash.
-- Stefan^2.
More information about the Zlib-devel
mailing list