[fpc-devel] Unit linking to .obj files and fpcmake.

Michalis Kamburelis mkambi at poczta.onet.pl
Wed Apr 12 00:20:14 CEST 2006


J. Peter Mugaas wrote:
[...]
> 
> And I noticed that the zlib1.dll filename is the same between the official ZLib .DLL and the the one you mentioned.   The zlib version you mentioned has a file size of 73.5 KB (75,264 bytes) while the official one has a file size of 58.5 KB (59,904 bytes).  What's the key difference between the two?  What are the standard calling conventions for them (stdcall or cdecl)?
> 

The one on official [http://www.zlib.net/] was compiled with Microsoft
Visual C++. While gnuwin32 uses MinGW gcc and binutils for compilation.
That's the difference. Fortunately, they both use the same calling
convention: cdecl (see DLL_FAQ.txt for official zlib123-dll.zip from
[http://www.zlib.net/] and
[http://www.mail-archive.com/gnuwin32-users@lists.sourceforge.net/msg00103.html])
so they should be compatible.

> 
>>Fortunately, there exists more-or-less standard zlib dll library for
>>win32. It can be obtained from [http://gnuwin32.sourceforge.net/].
>>It is
>>frequently updated, so all known security problems should be fixed
>>there. It's used by many programs (including gimp for windows, or
>>actually gtk 2 for windows; oh, and my programs :) ). It's named
>>zlib1.dll (with "1"), so no conflicts with zlib.dll. As far as I am
>>aware, no software dared to ever install incompatible zlib1.dll
>>version.
> 
> 
> It might be.  I still am biased towards static linking some type of object file (either the .obj form or an .a format) and I noticed that the distribution you mentioned does have libz.a.  Does that statically link all the zlib code or do would have to include the .dll?   If it does, then I might want to consider that instead.
> 

The .a file should contain the same thing as .dll, but for linking
statically. Libraries compiled on gnuwin32 (both static and dynamic) use
MinGW gcc and binutils for compilation, so they should be compatible
with FPC under Win32.

If I were you, I would still use dynamic library (.dll) anyway, because
that allows "advanced" users to manually update zlib1.dll your program uses.

Michalis



More information about the fpc-devel mailing list