www.digitalmars.com         C & C++   DMDScript  

c++ - zlib DLL


as a means of familiarizing myself with the DMC tools, I am trying to 
compile the zlib static library and DLL.

I adjusted the makefile for GNU make/gcc for DMC. It is attached.

It seems that the static lib is built correctly. The test application 
example.exe links with it and seems to run fine.

zlib version 1.2.3 = 0x1230, compile flags = 0x55
uncompress(): hello, hello!
gzread(): hello, hello!
gzgets() after gzseek:  hello!
inflate(): hello, hello!
large_inflate(): OK
after inflateSync(): hello, hello!
inflate with dictionary: hello, hello!

minigzip.exe, however, doesn't work:

echo hello world | minigzip | minigzip -d
F:\coding\dmc\libs\zlib\miniF:\coding\gzip.exe: can't 
gzip.exe: <fd:0>: Bad file descriptor

I suspect this has something to do with the pipes...

The DLL builds without errors and an import lib is generated. The DEF 
file I used is attached. However, running example_d.exe (also builds) 
will result in this output:

zlib version 1.2.3 = 0x1230, compile flags = 0x55

... and then hangs. I can CRTL-C out of it though.

As I don't have dumpexe, I attached the output of Borlands tdump of my 

I came across a post on c++.announce where someone made a makefile for 
zlib. It makes use of dllmain.c, which is not included in current 
versions of zlib (was it ever?). It seems that DllMain is only optional 
for building a DLL however 
(http://msdn2.microsoft.com/en-us/library/ms885202.aspx). Is that correct?

Kind regards,
Jan 21 2007