www.digitalmars.com         C & C++   DMDScript  

c++ - zlib DLL

Hello,

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.

<begin>
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!
<end>

minigzip.exe, however, doesn't work:

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

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:

<begin>
zlib version 1.2.3 = 0x1230, compile flags = 0x55
<end>

... 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 
zlib1.dll.

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,
Brecht
Jan 21 2007