Appendix 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 G.1: 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_SMART 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.
FPC_CROSSCOMPILINGDefined when the target OS/CPU
is different from the source OS/CPU.
FPC Always defined for Free Pascal.
VER2 Always defined for Free Pascal version 2.x.x.
VER2_0 Always defined for Free Pascal version 2.0.x.
VER2_2 Always defined for Free Pascal version 2.2.x.
FPC_VERSION Contains the major version number from FPC.
FPC_RELEASE Contains the minor version number from FPC.
FPC_PATCH Contains the third part of the version number from FPC.
FPC_FULLVERSION Contains the entire version number from FPC as a single
number which can be used for comparing. For FPC 2.2.4 it will contain 20204.
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 -MDelphi or
using the $MODE DELPHI directive.
FPC_OBJFPC Free Pascal is in OBJFPC mode, either using compiler switch -Mobjfpc or
using the $MODE OBJFPC directive.
FPC_TP Free Pascal is in Turbo Pascal mode, either using compiler switch -Mtp 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 G.2: Possible CPU defines when compiling using FPC

Define When defined?


CPU86 Free Pascal target is an Intel 80x86 or compatible (16 and 32 bit).
CPU87 Free Pascal target is an Intel 80x86 or compatible (16 and 32 bit).
CPU386 Free Pascal target is an Intel 80386 or later.
CPUI386 Free Pascal target is an Intel 80386 or later.
CPU68K Free Pascal target is a Motorola 680x0 or compatible.
CPUM68K Free Pascal target is a Motorola 680x0 or compatible.
CPUM68020 Free Pascal target is a Motorola 68020 or later.
CPU68 Free Pascal target is a Motorola 680x0 or compatible.
CPUSPARC32 Free Pascal target is a SPARC v7 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 or 64-bit PowerPC or compatible.
CPUPOWERPC32Free Pascal target is a 32-bit PowerPC or compatible.
CPUPOWERPC64Free Pascal target is a 64-bit PowerPC or compatible.
CPUX86_64 Free Pascal target is a AMD64 or Intel 64-bit processor.
CPUAMD64 Free Pascal target is a AMD64 or Intel 64-bit processor.
CPUX64 Free Pascal target is a AMD64 or Intel 64-bit processor
CPUIA64 Free Pascal target is a Intel itanium 64-bit processor.
CPUARM Free Pascal target is an ARM 32-bit processor.
CPUAVR Free Pascal target is an AVR 16-bit processor.
CPU16 Free Pascal target is a 16-bit CPU.
CPU32 Free Pascal target is a 32-bit CPU.
CPU64 Free Pascal target is a 64-bit CPU.


CPU8086 indicates a 16-bit x86 target (i8086)
CPUI8086 indicates a 16-bit x86 target (i8086)


Table G.3: Possible FPU defines when compiling using FPC

Define When defined?


FPUSOFT Software emulation of FPU (all types).
FPUSSE64 SSE64 FPU on Intel I386 and higher, AMD64.
FPUSSE SSE instructions on Intel I386 and higher.
FPUSSE2 SSE 2 instructions on Intel I386 and higher.
FPUSSE3 SSE 3 instructions on Intel I386 and higher, AMD64.
FPULIBGCC GCC library FPU emulation on ARM and M68K.
FPU68881 68881 on M68K.
FPUFPA FPA on ARM.
FPUFPA10 FPA 10 on ARM.
FPUFPA11 FPA 11 on ARM.
FPUVFP VFP on ARM.
FPUX87 X87 FPU on Intel I8086 and higher.
FPUITANIUM On Intel Itanium.
FPUSTANDARDOn PowerPC (32/64 bit).
FPUHARD On Sparc.




Table G.4: Possible defines when compiling using target OS

Target operating system Defines


linux LINUX, UNIX
freebsd FREEBSD, BSD, UNIX
netbsd NETBSD, BSD, UNIX
sunos SUNOS, SOLARIS, UNIX
go32v2 GO32V2, DPMI
MS-DOS 16 bit real modeMSDOS (2.7.1 and higher)
os2 OS2
emx OS2, EMX
Windows (all) WINDOWS
Windows 32-bit WIN32, MSWINDOWS
Windows 64-bit WIN64, MSWINDOWS
Windows (winCE) WINCE, UNDER_CE, UNICODE
Classic Amiga AMIGA
Atari TOS ATARI
Classic Macintosh MACOS
PalmOS PALMOS
BeOS BEOS, UNIX
QNX RTP QNX, UNIX
Mac OS X BSD, DARWIN, UNIX



On MS-DOS 16 bit, the memory model used to compile the program is defined in one of the defines FPC_MM_TINY, FPC_MM_SMALL,FPC_MM_MEDIUM, FPC_MM_COMPACT,FPC_MM_LARGE, FPC_MM_HUGE.

Remark: The unix define was added starting from Free Pascal version 1.0.5. The BSD operating systems no longer define LINUX starting with version 1.0.7.