Difference between revisions of "global compiler directives"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed wiki markup; typos)
(→‎Syntax: reword short description to be more accurate)
 
Line 14: Line 14:
 
Specific:
 
Specific:
  
* [[$extendedSyntax|<syntaxhighlight lang="pascal" inline>{$extendedSyntax}</syntaxhighlight>]] allows using functions as if they were procedures
+
* [[$extendedSyntax|<syntaxhighlight lang="pascal" inline>{$extendedSyntax}</syntaxhighlight>]] enables multiple syntax extensions
* [[$pointerMath|<syntaxhighlight lang="pascal" inline>{$pointerMath}</syntaxhighlight>]] allows arithmetic operations with pointers (since [[User Changes 2.6.0#The POINTERARITHMETICS mode switch has been replaced with the POINTERMATH directive|FPC 2.6.0]])
+
* [[$pointerMath|<syntaxhighlight lang="pascal" inline>{$pointerMath}</syntaxhighlight>]] automatically defines operators for new pointer data types (since [[User Changes 2.6.0#The POINTERARITHMETICS mode switch has been replaced with the POINTERMATH directive|FPC 2.6.0]])
 
* [[$openStrings|<syntaxhighlight lang="pascal" inline>{$openStrings}</syntaxhighlight> or <syntaxhighlight lang="pascal" inline>{$P}</syntaxhighlight>]] determines, whether all routine parameters of type <syntaxhighlight lang="pascal" inline>string</syntaxhighlight> are considered to be open string parameters; this parameter only has effect for short strings, not for <syntaxhighlight lang="pascal" inline>ANSIString</syntaxhighlight>s.
 
* [[$openStrings|<syntaxhighlight lang="pascal" inline>{$openStrings}</syntaxhighlight> or <syntaxhighlight lang="pascal" inline>{$P}</syntaxhighlight>]] determines, whether all routine parameters of type <syntaxhighlight lang="pascal" inline>string</syntaxhighlight> are considered to be open string parameters; this parameter only has effect for short strings, not for <syntaxhighlight lang="pascal" inline>ANSIString</syntaxhighlight>s.
 
* [[$varPropSetter|<syntaxhighlight lang="pascal" inline>{$varPropSetter}</syntaxhighlight>]]
 
* [[$varPropSetter|<syntaxhighlight lang="pascal" inline>{$varPropSetter}</syntaxhighlight>]]

Latest revision as of 14:23, 19 February 2021

Deutsch (de) English (en) français (fr) русский (ru)

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

General:

Specific:

Code generation

Data inclusion

Paths

Target-dependent

Novell NetWare only

Palm OS and Garnet OS only

  • {$appID} defines four-character application identifier
  • {$appName} determines the name of the application

Windows-based systems

  • {$imageBase} specifies DLL image base location
  • {$minStackSize}
  • {$maxStackSize}
  • {$setPEFlags}
  • {$version} defines version number of a DLL

Miscellaneous

Compile-time data

Ignored

  • {$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

Directives, definitions and conditionals definitions
global compiler directives • local compiler directives

Conditional Compiler Options • Conditional compilation • Macros and Conditionals • Platform defines
$IF