[fpc-devel]Report in manual inconsitencies about linking libraries, and questions.

Javier Ros Ganuza jros at unavarra.es
Fri Jan 30 12:15:25 CET 2004


Note: al the coments aplies to linux (vesions 1.06 and 1.0.10)

Manual page: 1.0.6 

 −CS    Create static library.

Manual page: 1.0.10

Not present in my system

prog.pdf in both versions:

Compiling libraries
 Once you have your (adapted) code, with exported and other functions,
you can compile your unit, and tell the compiler to make it into a
library. The compiler will simply compile your unit, and perform the
necessary steps to transform it into a static or shared (dynamic)
library. You can do this as follows, for a dynamic library:

 ppc386 -CD myunit

 On UNIX systems, such as LINUX, this will leave you with a file
libmyunit.so. On WINDOWS and OS/2, this will leave you with myunit.dll.
An easier way to create shared libraries is to use the library keyword.
For more information on creating shared libraries, chapter 11, page 93.
If you want a static library, you can do

 ppc386 -CS myunit

 This will leave you with libmyunit.a and a file myunit.ppu. The
myunit.ppu is the unit file needed by the Free Pascal compiler.

Behaviour in both versions

[jros kernel]$ ppc386 -CS the_unit.pp
Error: Illegal parameter: -CS
[jros kernel]$ ppc386 -CS the_dynamic_library.pp
Error: Illegal parameter: -CS
[jros kernel]$

-CD Behavior in both versions:

It is accepted, but the result is the same as if option not used


The comand line documentation in both versions:

[jros kernel]$ ppc386
Free Pascal Compiler version 1.0.10 [2003/06/26] for i386
Copyright (c) 1993-2003 by Florian Klaempfl
....

[jros kernel]$ ppc386
Free Pascal Compiler version 1.0.6 [2002/05/23] for i386
Copyright (c) 1993-2002 by Florian Klaempfl

...

Inline (ppc386) help in both versions:
....
 -C<x>  code generation options:
      -CD        create also dynamic library (not supported)


It does not apear -CS

The questions:

I'm able to link, the previous program with a ppc386 generated dynamic
library. It works!

I'm able to link static, making a static library using the object files
asociated to the units, generated in the dinamic library generating
procces, and
/usr/lib/fpc/1.0.10/units/linux/rtl/dllprt0.o
/usr/lib/fpc/1.0.10/units/linux/rtl/syslinux.o

It works, werther I use directly the object files or I package them in a
lib*.a library usin ar and ranlib

But in order to have a working link form C to the static lib I need:

---
extern void FPC_INITIALIZEUNITS (void);

int
main (int argc, char *argv[])
{
FPC_INITIALIZEUNITS();
...
---

Has been this trik already cicumvented?.

Is this a correct procedure?



More information about the fpc-devel mailing list