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.
VER3 Always defined for Free Pascal version 3.x.x.
VER3_0 Always defined for Free Pascal version 3.0.x.
VER3_2 Always defined for Free Pascal version 3.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_MACPAS Free Pascal is in Mac Pascal mode, either using compiler switch -Mmacpas or
using the $MODE MACPAS 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.


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


AIX AIX, UNIX
Amiga AMIGA
Android ANDROID
linux LINUX, UNIX
freebsd FREEBSD, BSD, UNIX, DRAGONFLY
netbsd NETBSD, BSD, UNIX
openbsd OPENBSD, BSD, UNIX
sunos SUNOS, SOLARIS, UNIX
go32v2 GO32V2, DPMI
MS-DOS 16 bit real modeMSDOS (2.7.1 and higher)
Haiku HAIKU
os2 OS2
NETWARE NETWARE, NETWLIBC
Nintendo DS NDS
emx OS2, EMX
Solaris SOLARIS
WII WII
Windows (native NT) NATIVENT
Windows (16-bit) WIN16
Windows (all) WINDOWS
Windows 32-bit WIN32, MSWINDOWS
Windows 64-bit WIN64, MSWINDOWS
Windows (winCE) WINCE, UNDER_CE, FPC_OS_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, IPHONESYM



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.


Table G.5: Feature defines

Define Feature


FPC_HAS_FEATURE_HEAP Dynamic memory management
FPC_HAS_FEATURE_INITFINAL Initialization and Finalization
FPC_HAS_FEATURE_RTTI RTTI information
FPC_HAS_FEATURE_CLASSES Classses
FPC_HAS_FEATURE_EXCEPTIONS Exception support
FPC_HAS_FEATURE_EXITCODE Program exit code
FPC_HAS_FEATURE_ANSISTRINGS AnsiStrings
FPC_HAS_FEATURE_WIDESTRINGS WideStrings
FPC_HAS_FEATURE_TEXTIO Text file I/O
FPC_HAS_FEATURE_CONSOLEIO Console I/O
FPC_HAS_FEATURE_FILEIO Raw file I/O
FPC_HAS_FEATURE_RANDOM Random function
FPC_HAS_FEATURE_VARIANTS Variant support
FPC_HAS_FEATURE_OBJECTS TP object support
FPC_HAS_FEATURE_DYNARRAYS Dynamic arrays
FPC_HAS_FEATURE_THREADING Threading support
FPC_HAS_FEATURE_COMMANDARGS Command-line argument support
FPC_HAS_FEATURE_PROCESSES Process execution support
FPC_HAS_FEATURE_STACKCHECK Stack checking
FPC_HAS_FEATURE_DYNLIBS Dynamic library loading
FPC_HAS_FEATURE_SOFTFPU Software FPU emulation
FPC_HAS_FEATURE_OBJECTIVEC1 Objective C support
FPC_HAS_FEATURE_RESOURCES Resources support
FPC_HAS_FEATURE_UNICODESTRINGSUnicode string support




Table G.6: Temporary Feature defines

Define Feature


FPC_HAS_WINLIKERESOURCES Windows-like resource
FPC_HAS_TYPE_EXTENDED Extended floating point type
FPC_HAS_TYPE_DOUBLE Double floating point type
FPC_HAS_TYPE_SINGLE Single floating point type
FPC_HAS_TYPE_FLOAT128 128-bit floating point type
FPC_HAS_INTERNAL_ABS_SHORTINT Internal handling of Abs() for shortint (8-bit)
FPC_HAS_INTERNAL_ABS_SMALLINT Internal handling of Abs() for smallint (16-bit)
FPC_HAS_INTERNAL_ABS_LONG Internal handling of Abs() for longint (32-bit)
FPC_HAS_INTERNAL_ABS_INT64 Internal handling of Abs() for int64 (64-bit)
FPC_HAS_UNICODESTRING Unicode string type
FPC_HAS_CPSTRING Codepage string type
FPC_HAS_RIP_RELATIVE relative addressing
FPC_HAS_CEXTENDED C extended type
FPC_HAS_RESSTRINITS Initialization of resource strings
FPC_HAS_INTERNAL_ROX Internal ROX command
FPC_HAS_LWSYNC ?
FPC_HAS_INTERNAL_SAR Internal SAR command
FPC_HAS_OPERATOR_ENUMERATOR Enumerator operator support
FPC_HAS_CONSTREF Constref keyword support
FPC_HAS_MEMBAR Memory barrier support
FPC_HAS_FEATURE_SUPPORT HAS_FEATURE_ support
FPC_HAS_INTERNAL_BSF Internal support for BSF
FPC_HAS_INTERNAL_BSR Internal support for BSR
FPC_HAS_FAST_FMA_SINGLE Fast floating point FMA for single floats
FPC_HAS_FAST_FMA_DOUBLE Fast floating point FMA for double floats
FPC_HAS_INDIRECT_ENTRY_INFORMATIONIndirect entry information support
FPC_HAS_DYNAMIC_PACKAGES Dynamic packages support
FPC_HAS_INDIRECT_VAR_ACCESS Indirect variable access