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

#### 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 U N I X systems, such as L I N U X, this will leave you with a file libmyunit.so. On WI N D O W S and O S/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 436.

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.

The resulting files are then libraries. To make static libraries, you need the ranlib or ar program on your system. It is standard on most U N I X systems, and is provided with the gcc compiler under D O S. For the dos distribution, a copy of ar is included in the file gnuutils.zip.

BEWARE: This command doesn’t include anything but the current unit in the library. Other units are left out, so if you use code from other units, you must deploy them together with your library.

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