Free Pascal supports compiler directives in the source file. Basically the same directives as in Turbo Pascal, Delphi and Apple Pascal (Mac OS) pascal compilers are supported. Some are recognized for compatibility only, and have no effect.
Syntax
editGeneral:
{$mode}selects the compiler mode{$modeSwitch}turns on or off specific mode features
Specific:
{$extendedSyntax}enables multiple syntax extensions{$pointerMath}automatically defines operators for new pointer data types (since FPC 2.6.0){$openStrings}or{$P}determines, whether all routine parameters of typestringare considered to be open string parameters; this parameter only has effect for short strings, not forANSIStrings.{$varPropSetter}
Code generation
edit{$codePage}determines which code page is used by the program{$E}emulate co-processor{$extension}determines file name suffix of the generated executable{$libPrefix}determines file name prefix a generated library{$libSuffix}determines file name suffix a generated library{$memory}determines size of memory to use{$PascalMainName}determines name of entry point{$PIC}enables position independent code code generation{$smartlink}determines smartlinking{$sysCalls}determines system call calling conventions on Amiga/MorphOS
Data inclusion
edit{$debugInfo}or{$D}inserts GNU debugging information into generated code{$referenceInfo}or{$Y}creates Delphi-compatible browser information (not yet fully supported)
Paths
edit{$frameworkPath}(on Darwin){$includePath}determines path for include files{$libraryPath}determines the path to library files{$objectPath}defines the path to search for object files at{$unitPath}determines search path for units
Target-dependent
editNovell NetWare only
edit{$copyright}inserts copyright information{$screenName}determines screen name of application{$threadName}defines name of thread
Palm OS and Garnet OS only
edit{$appID}defines four-character application identifier{$appName}determines the name of the application
Windows-based systems
edit{$imageBase}specifies DLL image base location{$minStackSize}{$maxStackSize}{$setPEFlags}{$version}defines version number of a DLL
Miscellaneous
edit{$appType}determines the program type
Compile-time data
edit{$profile}enables generation of profile code
Ignored
edit{$description}: introduced for compatibility and as of FPC 3.0.4 ignored{$G}would generate 80286 code with TP{$localSymbols}or{$L}{$N}(numeric processing){$O}enabled level 2 optimizations. It is not recognized anymore since FPC 2.0.0. Use{$optimization}instead.{$weakPackageUnit}
See also
edit| Directives, definitions and conditionals definitions |
|---|
| global compiler directives • local compiler directives Conditional Compiler Options • Conditional compilation • Macros and Conditionals • Platform defines $IF |