Compiling libraries

[next] [prev] [prev-tail] [tail] [up]

#### 7.2.3 Compiling libraries

To create shared libraries one should use the library keyword in the main compilation file (the project file). For more information on creating shared libraries, chapter 12, page 644.

The .o object files that the compiler writes when it compiles a unit, are regular object files as they are produced by a C compiler. They can be combined using the ar and ranlib tools into a static library. However, for various reasons, this is a bad idea.

- The code will be full of references to compiler internal routines in the RTL. These routines are not present in a C library.
- The initialization sections will not be called by a C program.
- The thread vars will not be allocated (or initialized).
- Resource strings will not be initialized.
- Each library thus made will attempt to initialize the RTL.

To remedy these (and other) problems requires intimate knowledge of the inner workings of the compiler and RTL, and it is therefore a bad idea to attempt the use of static libraries with Free Pascal.

[next] [prev] [prev-tail] [front] [up]