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

J. Peter Mugaas jpmugaas at charter.net
Thu Apr 13 17:57:45 CEST 2006


On Thu, 13 Apr 2006 12:11:36 -0300, Felipe Monteiro de Carvalho wrote:
> Hello,
>
> Just one note.
>
> You don´t need to use a external dll to use the c version. On a
> Delphi project of mine I use ZLibEx.pas
>
> It is a pascal file that statically imports .o files compiled from
> the "official" c sources using c++ builder and offers some Stream
> objects to use ZLib with TFileStream (or other streams you want to
> use), so it´s really easy to use.
>
> You can download it here:
>
> http://www.dellapasqua.com/delphizlib/
>
> It was created by Borland and Base2 technologies and is the version
> distributed with Delphi.
>
> There are some issues however:
>
> 1 - Windows only
>
> 2 - Was made with Delphi in mind, so may need some minor changes to
> compile with Free Pascal, like adding {$mode delphi}
>
That is based on ZLib 1.2.2 and ZLib 1.2.2 has a Cert warnings about a security flaws.

http://www.kb.cert.org/vuls/id/238678
http://www.kb.cert.org/vuls/id/680620

ZLib 1.2.3 fixes those.   The thing is that FreePascal might not be able to use standard .obj files in Windows (at least that's what everyone was telling me) and that has to do with the ld linker.  Even if that does work, there would probably have to some Makefile rules for handling the object files (such as place them in the compiled units dir) and I was told I would have to write my own rules for that and I have not yet been able to do this because I don't know how).

What I had to do was dynamically load a .DLL and document in my readme file where to get it.  The one I use is based on  the "Enhanced zlib package" from Borland's Code Central (entry ID: 23490) which I then modified for Indy usage and modified so that you can use it in FreePascal.  I tested it with an example program in Linux and Win32.
-- 
I once had an open mind until people used it as a trashcan. 
J. Peter Mugaas, E-Mail:  oma00215 at mail.wvnet.edu
http://www.wvnet.edu/~oma00215



More information about the fpc-devel mailing list