$PIC : Generate PIC code or not

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

#### 1.3.28 $PIC : Generate PIC code or not

The {$PIC } directive takes a boolean argument and tells the compiler whether it should generate PIC (Position Independent Code) or not. This directive is the equivalent of the -Cg command line switch.

This directive is only useful on Unix platforms: Units should be compiled using PIC code if they are supposed to be in a library. For programs, using PIC code is not needed, but it doesn’t hurt either (although PIC code is slower).

The following

{$PIC ON}
unit MyUnit;

tells the compiler to compile myunit using PIC code.

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