global compiler directives: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: global compiler directives
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Free Pascal supports [[Compiler directive|compiler directives]] in the [[Source code|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. | |
| 2 | + | ||
| 3 | + | ## Syntax | |
| 4 | + | ||
| 5 | + | General: | |
| 6 | + | ||
| 7 | + | - [[$mode|{$mode}]] selects the compiler mode | |
| 8 | + | - [[$modeSwitch|{$modeSwitch}]] turns on or off specific mode features | |
| 9 | + | ||
| 10 | + | Specific: | |
| 11 | + | ||
| 12 | + | - [[$extendedSyntax|{$extendedSyntax}]] enables multiple syntax extensions | |
| 13 | + | - [[$pointerMath|{$pointerMath}]] automatically defines operators for new pointer data types (since [[User Changes 2.6.0|FPC 2.6.0]]) | |
| 14 | + | - [[$openStrings|{$openStrings} or {$P}]] determines, whether all routine parameters of type `string` are considered to be open string parameters; this parameter only has effect for short strings, not for `ANSIString`s. | |
| 15 | + | - [[$varPropSetter|{$varPropSetter}]] | |
| 16 | + | ||
| 17 | + | ## Code generation | |
| 18 | + | ||
| 19 | + | - [[$codePage|{$codePage}]] determines which code page is used by the program | |
| 20 | + | - [[$E|{$E}]] emulate co-processor | |
| 21 | + | - [[$extension|{$extension}]] determines file name suffix of the generated [[Executable program|executable]] | |
| 22 | + | - [[$libPrefix and $libSuffix|{$libPrefix}]] determines file name prefix a generated library | |
| 23 | + | - [[$libPrefix and $libSuffix|{$libSuffix}]] determines file name suffix a generated library | |
| 24 | + | - [[$memory|{$memory}]] determines size of memory to use | |
| 25 | + | - [[$pascalMainName|{$PascalMainName}]] determines name of entry point | |
| 26 | + | - [[$PIC|{$PIC}]] enables position independent code code generation | |
| 27 | + | - [[$smartlink|{$smartlink}]] determines smartlinking | |
| 28 | + | - [[$sysCalls|{$sysCalls}]] determines system call calling conventions on Amiga/MorphOS | |
| 29 | + | ||
| 30 | + | ## Data inclusion | |
| 31 | + | ||
| 32 | + | - [[$debugInfo|{$debugInfo} or {$D}]] inserts GNU debugging information into generated code | |
| 33 | + | - [[$referenceInfo|{$referenceInfo} or {$Y}]] creates Delphi-compatible browser information (not yet fully supported) | |
| 34 | + | ||
| 35 | + | ## Paths | |
| 36 | + | ||
| 37 | + | - [[$framework|{$frameworkPath}]] (on Darwin) | |
| 38 | + | - [[$include|{$includePath}]] determines path for include files | |
| 39 | + | - [[FPC paths|{$libraryPath}]] determines the path to library files | |
| 40 | + | - [[FPC paths|{$objectPath}]] defines the path to search for object files at | |
| 41 | + | - [[FPC paths|{$unitPath}]] determines search path for units | |
| 42 | + | ||
| 43 | + | ## Target-dependent | |
| 44 | + | ||
| 45 | + | ### Novell NetWare only | |
| 46 | + | ||
| 47 | + | - [[$copyright|{$copyright}]] inserts copyright information | |
| 48 | + | - [[$screenName|{$screenName}]] determines screen name of application | |
| 49 | + | - [[$threadName|{$threadName}]] defines name of thread | |
| 50 | + | ||
| 51 | + | ### Palm OS and Garnet OS only | |
| 52 | + | ||
| 53 | + | - `{$appID}` defines four-character application identifier | |
| 54 | + | - `{$appName}` determines the name of the application | |
| 55 | + | ||
| 56 | + | ### Windows-based systems | |
| 57 | + | ||
| 58 | + | - [[$imageBase|{$imageBase}]] specifies DLL image base location | |
| 59 | + | - `{$minStackSize}` | |
| 60 | + | - `{$maxStackSize}` | |
| 61 | + | - `{$setPEFlags}` | |
| 62 | + | - `{$version}` defines version number of a DLL | |
| 63 | + | ||
| 64 | + | ### Miscellaneous | |
| 65 | + | ||
| 66 | + | - [[$appType|{$appType}]] determines the program type | |
| 67 | + | ||
| 68 | + | ## Compile-time data | |
| 69 | + | ||
| 70 | + | - [[$profile|{$profile}]] enables generation of profile code | |
| 71 | + | ||
| 72 | + | ## Ignored | |
| 73 | + | ||
| 74 | + | - `{$description}`: introduced for compatibility and as of FPC 3.0.4 ignored | |
| 75 | + | - `{$G}` would generate 80286 code with [[Turbo Pascal|TP]] | |
| 76 | + | - `{$localSymbols}` or `{$L}` | |
| 77 | + | - `{$N}` (numeric processing) | |
| 78 | + | - `{$O}` enabled level 2 optimizations. It is not recognized anymore since FPC 2.0.0. Use [[$optimization|{$optimization}]] instead. | |
| 79 | + | - `{$weakPackageUnit}` | |
| 80 | + | ||
| 81 | + | ## See also | |
| 82 | + | ||
| 83 | + | - [[Pascal basics]] | |
| 84 | + | - [§ “global directives” in the *Free Pascal programmer’s guide*](https://www.freepascal.org/docs-html/prog/progse3.html) | |
| 85 | + | ||
| 86 | + | --- | |
| 87 | + | *From the Free Pascal wiki, page "global compiler directives", as it stood on 2021-02-19 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
