Chapter 1
Compiler directives

Free Pascal supports compiler directives in the source file. They are not the same as Turbo Pascal directives, although some are supported for compatibility. There is a distinction between local and global directives; local directives take effect from the moment they are encountered, global directives have an effect on all of the compiled code.

Many switches have a long form also. If they do, then the name of the long form is given also. For long switches, the + or - character to switch the option on or off, may be replaced by ON or OFF keywords.

Thus {$I+} is equivalent to {$IOCHECKS ON} or {$IOCHECKS +} and {$C-} is equivalent to {$ASSERTIONS OFF} or {$ASSERTIONS -}

The long forms of the switches are the same as their Delphi counterparts.


 1.1 Local directives
   $A or $ALIGN : Align Data
   $ASMMODE : Assembler mode (Intel 80x86 only)
   $B or $BOOLEVAL : Complete boolean evaluation
   $C or $ASSERTIONS : Assertion support
   $DEFINE : Define a symbol
   $ELSE : Switch conditional compilation
   $ENDIF : End conditional compilation
   $ERROR : Generate error message
   $F : Far or near functions
   $FATAL : Generate fatal error message
   $GOTO : Support Goto and Label
   $H or $LONGSTRINGS : Use AnsiStrings
   $HINT : Generate hint message
   $HINTS : Emit hints
   $IF : Start conditional compilation
   $IFDEF Name : Start conditional compilation
   $IFNDEF : Start conditional compilation
   $IFOPT : Start conditional compilation
   $INFO : Generate info message
   $INLINE : Allow inline code.
   $I or $IOCHECKS : Input/Output checking
   $I or $INCLUDE : Include file
   $I or $INCLUDE : Include compiler info
   $I386__ XXX : Specify assembler format (Intel 80x86 only)
   $L or $LINK : Link object file
   $LINKLIB : Link to a library
   $M or $TYPEINFO : Generate type info
   $MACRO : Allow use of macros.
   $MAXFPUREGISTERS : Maximum number of FPU registers for variables (Intel 80x86 only)
   $MESSAGE : Generate info message
   $MMX : Intel MMX support (Intel 80x86 only)
   $NOTE : Generate note message
   $NOTES : Emit notes
   $OUTPUT__ FORMAT : Specify the output format
   $P or $OPENSTRINGS : Use open strings
   $PACKENUM : Minimum enumeration type size
   $PACKRECORDS : Alignment of record elements
   $Q $OVERFLOWCHECKS: Overflow checking
   $R or $RANGECHECKS : Range checking
   $SATURATION : Saturation operations (Intel 80x86 only)
   $SMARTLINK : Use smartlinking
   $STATIC : Allow use of Static keyword.
   $STOP : Generate fatal error message
   $T or $TYPEDADDRESS : Typed address operator (@)
   $UNDEF : Undefine a symbol
   $V or $VARSTRINGCHECKS : Var-string checking
   $WAIT : Wait for enter key press
   $WARNING : Generate warning message
   $WARNINGS : Emit warnings
   $X or $EXTENDEDSYNTAX : Extended syntax
 1.2 Global directives
   $APPTYPE : Specify type of application (Win32 and AmigaOS only)
   $D or $DEBUGINFO : Debugging symbols
   $DESCRIPTION : Application description
   $E : Emulation of coprocessor
   $G : Generate 80286 code
   $INCLUDEPATH : Specify include path.
   $L or $LOCALSYMBOLS : Local symbol information
   $LIBRARYPATH : Specify library path.
   $M or $MEMORY : Memory sizes
   $MODE : Set compiler compatibility mode
   $N : Numeric processing
   $O : Overlay code generation
   $OBJECTPATH : Specify object path.
   $S : Stack checking
   $UNITPATH : Specify unit path.
   $W or $STACKFRAMES : Generate stackframes
   $Y or $REFERENCEINFO : Insert Browser information