January 23, 2007
Hello,

(I first posted this to c++, but this is probably a better place)

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


January 23, 2007
I wrote:
> 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?

It seems that DllMain is required after all. example.exe will run when I include DllMain.

I have also tried building a libpng DLL with DMC, but I also run into
trouble there. I should probably find out what's causing the minigzip
error first:
 > <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...

I have tried to debug minigzip with the help of WinDbg. I'm not quite used to it as of yet. Unfortunately I can't inspect local variables. Is it possible to have DMC generate private symbols?

Perhaps someone else has a clue of what might be causing the error?

I have attached the new makefile and dllmain.c (goes in win32 dir).

Regards,
Brecht