#
G. Compiler defines during compilation

This appendix describes the possible defines when compiling programs using Free Pascal. A brief explanation of the define, and when it is used is also given.

Table: Possible defines when compiling using FPC
Define | description
FPC_LINK_DYNAMIC | Defined when the output will be linked dynamically.
| This is defined when using the -XD compiler switch.
FPC_LINK_STATIC | Defined when the output will be linked statically.
| This is the default mode.
FPC_LINK_SHARED | Defined when the output will be smartlinked.
| This is defined when using the -XX compiler switch.
FPC_PROFILE | Defined when profiling code is added to program.
| This is defined when using the -pg compiler switch.
FPK | Always defined for Free Pascal.
FPC | Always defined for Free Pascal.
VER1 | Always defined for Free Pascal version 1.x.x.
VER1_0 | Always defined for Free Pascal version 1.0.x.
ENDIAN_LITTLE | Defined when the Free Pascal target is a little-endian processor
| (80x86, Alpha, ARM).
ENDIAN_BIG | Defined when the Free Pascal target is a big-endian processor
| (680x0, PowerPC, SPARC, MIPS).
FPC_DELPHI | Free Pascal is in Delphi mode, either using compiler switch -Sd or
| using the `$MODE DELPHI` directive.
FPC_OBJFPC | Free Pascal is in Delphi mode, either using compiler switch -S2 or
| using the `$MODE OBJFPC` directive.
FPC_TP | Free Pascal is in Turbo Pascal mode, either using compiler switch -So or
| using the `$MODE TP` directive.
FPC_GPC | Free Pascal is in GNU Pascal mode, either using compiler switch -Sp or
| using the `$MODE GPC` directive.

Remark: The `ENDIAN_LITTLE` and `ENDIAN_BIG` defines were added starting from Free Pascal version 1.0.5.

Table: Possible CPU defines when compiling using FPC
Define | When defined?
CPU86 | Free Pascal target is an Intel 80x86 or compatible.
CPU87 | Free Pascal target is an Intel 80x86 or compatible.
CPUI386 | Free Pascal target is an Intel 80x86 or compatible.
CPU68k | Free Pascal target is a Motorola 680x0 or compatible.
CPU68 | Free Pascal target is a Motorola 680x0 or compatible.
CPUSPARC | Free Pascal target is a SPARC v7 or compatible.
CPUALPHA | Free Pascal target is an Alpha AXP or compatible.
CPUPOWERPC | Free Pascal target is a 32-bit PowerPC or compatible.

Table: Possible defines when compiling using target OS
Target operating system | Defines
linux | LINUX, UNIX
freebsd | FREEBSD, BSD, LINUX, UNIX
netbsd | NETBSD, BSD, LINUX, UNIX
sunos | SUNOS, SOLARIS, UNIX
go32v2 | GO32V2, DPMI
os2 | OS2
Windows 32-bit | WIN32
Classic Amiga | AMIGA
Atari TOS | ATARI
Classic Macintosh | MAC
PalmOS | PALMOS
BeOS | BEOS, UNIX
QNX RTP | QNX, UNIX

Remark: The UNIX define was added starting from Free Pascal version 1.0.5.