Free Pascal Programmer’s Guide Programmer’s Guide for Free Pascal, Version 3.0.0 Document version 3.0 November 2015 Michaël Van Canneyt Contents 1 Compiler directives 13 1.1 Introduction....................................... 13 1.2 Local directives..................................... 14 1.2.1 $A or $ALIGN : Align Data.......................... 14 1.2.2 $A1, $A2,$A4 and $A8 ............................ 14 1.2.3 $ASMMODE : Assembler mode (Intel 80x86 only)............... 15 1.2.4 $B or $BOOLEVAL : Complete boolean evaluation.............. 15 1.2.5 $C or $ASSERTIONS : Assertion support................... 15 1.2.6 $BITPACKING : Enable bitsize packing................... 16 1.2.7 $CALLING : Specify calling convention.................... 16 1.2.8 $CHECKPOINTER : Check pointer values................... 16 1.2.9 $CODEALIGN : Set the code alignment.................... 17 1.2.10 $COPERATORS : Allow C like operators................... 18 1.2.11 $DEFINE or $DEFINEC : Define a symbol.................. 18 1.2.12 $ELSE : Switch conditional compilation................... 18 1.2.13 $ELSEC : Switch conditional compilation................... 19 1.2.14 $ELSEIF or $ELIFC : Switch conditional compilation........... 19 1.2.15 $ENDC : End conditional compilation..................... 19 1.2.16 $ENDIF : End conditional compilation.................... 19 1.2.17 $ERROR or $ERRORC : Generate error message............... 20 1.2.18 $ENDREGION: End of a collapsible region.................. 20 1.2.19 $EXTENDEDSYM: Ignored........................... 20 1.2.20 $EXTERNALSYM: Ignored........................... 20 1.2.21 $F : Far or near functions........................... 20 1.2.22 $FATAL : Generate fatal error message.................... 21 1.2.23 $FPUTYPE : Select coprocessor type..................... 21 1.2.24 $GOTO : Support Goto and Label ...................... 22 1.2.25 $H or $LONGSTRINGS : Use AnsiStrings.................. 22 1.2.26 $HINT : Generate hint message........................ 22 1.2.27 $HINTS : Emit hints.............................. 22 1 CONTENTS 1.2.28 $HPPEMIT: Ignored.............................. 22 1.2.29 $IF : Start conditional compilation...................... 23 1.2.30 $IFC : Start conditional compilation..................... 23 1.2.31 $IFDEF Name : Start conditional compilation................ 23 1.2.32 $IFNDEF : Start conditional compilation................... 23 1.2.33 $IFOPT : Start conditional compilation.................... 23 1.2.34 $IMPLICITEXCEPTIONS : Implicit finalization code generation...... 23 1.2.35 $INFO : Generate info message........................ 24 1.2.36 $INLINE : Allow inline code.......................... 24 1.2.37 $INTERFACES : Specify Interface type.................... 24 1.2.38 $I or $IOCHECKS : Input/Output checking.................. 24 1.2.39 $IEEEERRORS : Enable IEEE error checking for constants......... 25 1.2.40 $I or $INCLUDE : Include file........................ 25 1.2.41 $I or $INCLUDE : Include compiler info................... 26 1.2.42 $J or $WRITEABLECONST : Allow assignments to typed consts...... 27 1.2.43 $L or $LINK : Link object file......................... 27 1.2.44 $LIBEXPORT : Ignored............................ 28 1.2.45 $LINKFRAMEWORK : Link to a framework.................. 28 1.2.46 $LINKLIB : Link to a library......................... 28 1.2.47 $M or $TYPEINFO : Generate type info.................... 29 1.2.48 $MACRO : Allow use of macros......................... 29 1.2.49 $MAXFPUREGISTERS : Maximum number of FPU registers for variables. 29 1.2.50 $MESSAGE : Generate info message...................... 30 1.2.51 $MINENUMSIZE : Specify minimum enumeration size............ 30 1.2.52 $MINFPCONSTPREC : Specify floating point constant precision....... 30 1.2.53 $MMX : Intel MMX support (Intel 80x86 only)................ 30 1.2.54 $NODEFINE : Ignored............................. 31 1.2.55 $NOTE : Generate note message........................ 31 1.2.56 $NOTES : Emit notes.............................. 31 1.2.57 $OBJECTCHECKS : Check Object...................... 31 1.2.58 $OPTIMIZATION : Enable Optimizations.................. 32 1.2.59 $PACKENUM or $Z : Minimum enumeration type size............ 33 1.2.60 $PACKRECORDS : Alignment of record elements............... 33 1.2.61 $PACKSET : Specify set size......................... 34 1.2.62 $POP : Restore compiler settings....................... 34 1.2.63 $PUSH : Save compiler settings........................ 34 1.2.64 $Q or $OV or $OVERFLOWCHECKS: Overflow checking........... 34 1.2.65 $R or $RANGECHECKS : Range checking................... 35 1.2.66 $REGION : Mark start of collapsible region.................. 35 1.2.67 $R or $RESOURCE : Include resource..................... 35 2 CONTENTS 1.2.68 $SATURATION : Saturation operations (Intel 80x86 only).......... 35 1.2.69 $SAFEFPUEXCEPTIONS Wait when storing FPU values on Intel x86... 36 1.2.70 $SCOPEDENUMS Control use of scoped enumeration types......... 36 1.2.71 $SETC : Define and assign a value to a symbol................ 36 1.2.72 $STATIC : Allow use of Static keyword.................. 37 1.2.73 $STOP : Generate fatal error message..................... 37 1.2.74 $STRINGCHECKS : Ignored.......................... 37 1.2.75 $T or $TYPEDADDRESS : Typed address operator (@)........... 37 1.2.76 $UNDEF or $UNDEFC : Undefine a symbol.................. 38 1.2.77 $V or $VARSTRINGCHECKS : Var-string checking............. 38 1.2.78 $W or $STACKFRAMES : Generate stackframes................ 39 1.2.79 $WAIT : Wait for enter key press....................... 39 1.2.80 $WARN : Control emission of warnings.................... 39 1.2.81 $WARNING : Generate warning message................... 40 1.2.82 $WARNINGS : Emit warnings......................... 40 1.2.83 $Z1, $Z2 and $Z4 ............................... 40 1.3 Global directives.................................... 41 1.3.1 $APPID : Specify application ID........................ 41 1.3.2 $APPNAME : Specify application name..................... 41 1.3.3 $APPTYPE : Specify type of application.................... 41 1.3.4 $CALLING : Default calling convention.................... 42 1.3.5 $CODEPAGE : Set the source codepage.................... 42 1.3.6 $COPYRIGHT specify copyright info..................... 43 1.3.7 $D or $DEBUGINFO : Debugging symbols.................. 43 1.3.8 $DESCRIPTION : Application description.................. 43 1.3.9 $E : Emulation of coprocessor......................... 43 Intel 80x86 version............................... 43 Motorola 680x0 version............................ 43 1.3.10 $EXTENSION : Extension of generated binary................. 43 1.3.11 $FRAMEWORKPATH : Specify framework path................. 44 1.3.12 $G : Generate 80286 code........................... 44 1.3.13 $IMAGEBASE : Specify DLL image base location............... 44 1.3.14 $INCLUDEPATH : Specify include path.................... 44 1.3.15 $L or $LOCALSYMBOLS : Local symbol information............ 45 1.3.16 $LIBPREFIX : Specify library filename prefix................ 45 1.3.17 $LIBRARYPATH : Specify library path..................... 45 1.3.18 $LIBSUFFIX : Set the library suffix..................... 45 1.3.19 $MAXSTACKSIZE : Set maximum stack size................. 46 1.3.20 $M or $MEMORY : Memory sizes........................ 46 1.3.21 $MINSTACKSIZE : Set minimum stack size................. 46 3 CONTENTS 1.3.22 $MODE : Set compiler compatibility mode................... 46 1.3.23 $MODESWITCH : Select mode features.................... 47 1.3.24 $N : Numeric processing........................... 48 1.3.25 $O : Level 2 Optimizations.......................... 48 1.3.26 $OBJECTPATH : Specify object path...................... 48 1.3.27 $P or $OPENSTRINGS : Use open strings.................. 49 1.3.28 $PASCALMAINNAME : Set entry point name................. 49 1.3.29 $PIC : Generate PIC code or not....................... 49 1.3.30 $POINTERMATH : Allow use of pointer math................. 49 1.3.31 $PROFILE : Profiling............................. 49 1.3.32 $S : Stack checking.............................. 49 1.3.33 $SCREENNAME : Specify screen name.................... 50 1.3.34 $SETPEFLAGS : Specify PE Executable flags................ 50 1.3.35 $SMARTLINK : Use smartlinking....................... 50 1.3.36 $SYSCALLS : Select system calling convention on Amiga/MorphOS.... 51 1.3.37 $THREADNAME : Set thread name in Netware................. 51 1.3.38 $UNITPATH : Specify unit path........................ 51 1.3.39 $VARPROPSETTER : Enable use of var/out/const parameters for property setters...................................... 51 1.3.40 $VERSION : Specify DLL version....................... 52 1.3.41 $WEAKPACKAGEUNIT : ignored....................... 52 1.3.42 $X or $EXTENDEDSYNTAX : Extended syntax................ 52 1.3.43 $Y or $REFERENCEINFO : Insert Browser information........... 53 2 Using conditionals, messages and macros 54 2.1 Conditionals....................................... 54 2.1.1 Predefined symbols............................... 55 2.2 Macros......................................... 55 2.3 Compile time variables................................. 57 2.4 Compile time expressions................................ 57 2.4.1 Definition.................................... 57 2.4.2 Usage...................................... 59 2.5 Messages........................................ 62 3 Using Assembly language 64 3.1 Using assembler in the sources............................. 64 3.2 Intel 80x86 Inline assembler.............................. 65 3.2.1 Intel syntax..................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages176 Page
-
File Size-