[fpc-pascal]How to use Linux libraries?

Marco van de Voort marcov at stack.nl
Thu Jul 24 12:07:52 CEST 2003


> never had to deal with this and have absolutely no knowledge about how to do
> such things.
> Please, be so kind and help me understanding how I can use external Linux
> libraries.
> 
> What I basically want to do is:   Reading images into memory.
> 
> Because there are so many different jpg/tif formats, I gave up writing all
> this code by myself and I would like to use one of the already existing
> libraries instead.

A Pascal translation of the jpg library is already included with FPC.

For libraries in general, you have to translate the C header file. This can
be done to a certain account by the tool h2pas packaged with FPC, but
requires manual intervention afterwards.

Then add 

{$linklib <library name>} to your header file unit, and make sure the
<library name>.a file can be found by the compiler (-Fl) options.

There should be quite some info about this in the manual.

> Please, if somebody of you already has some code which shows me how to do
> that, how to embed a library, how to call the library functions, etc., leave
> me some code. It is much easier to understand than reading some highly

Also don't forget that there are a lot of examples already in the FPC 
sources. Half of the packages/ hierarchy interfaces to some C library.




More information about the fpc-pascal mailing list