Free Pascal
User’s Guide


_____________________________________________________________________
User’s Guide for Free Pascal, Version 3.2.2
Document version 3.2.2
May 2021

Michaël Van Canneyt
Florian Klämpfl

____________________________________________________________________________
Contents
1 Introduction
 1.1 About this document
 1.2 About the compiler
 1.3 Getting more information.
2 Installing the compiler
 2.1 Before Installation : Requirements
  2.1.1 Hardware requirements
  2.1.2 Software requirements
 2.2 Installing the compiler.
  2.2.1 Installing under Windows
  2.2.2 Installing under DOS or OS/2
  2.2.3 Installing under Linux
 2.3 Optional configuration steps
 2.4 Before compiling
 2.5 Testing the compiler
3 Compiler usage
 3.1 File searching
  3.1.1 Command line files
  3.1.2 Unit files
  3.1.3 Include files
  3.1.4 Object files
  3.1.5 Configuration file
  3.1.6 About long filenames
 3.2 Compiling a program
 3.3 Compiling a unit
 3.4 Units, libraries and smartlinking
 3.5 Reducing the size of your program
4 Compiling problems
 4.1 General problems
 4.2 Problems you may encounter under DOS
5 Compiler configuration
 5.1 Using the command line options
  5.1.1 General options
  5.1.2 Options for getting feedback
  5.1.3 Options concerning files and directories
  5.1.4 Options controlling the kind of output.
  5.1.5 Options concerning the sources (language options)
 5.2 Using the configuration file
  5.2.1 Conditional processing of the config file
  5.2.2 #CFGDIR
  5.2.3 #IFDEF
  5.2.4 #IFNDEF
  5.2.5 #ELSE
  5.2.6 #ENDIF
  5.2.7 #DEFINE
  5.2.8 #UNDEF
  5.2.9 #WRITE
  5.2.10 #INCLUDE
  5.2.11 #SECTION
 5.3 Variable substitution in paths
6 The IDE
 6.1 First steps with the IDE
  6.1.1 Starting the IDE
  6.1.2 IDE command line options
  6.1.3 The IDE screen
 6.2 Navigating in the IDE
  6.2.1 Using the keyboard
  6.2.2 Using the mouse
  6.2.3 Navigating in dialogs
 6.3 Windows
  6.3.1 Window basics
  6.3.2 Sizing and moving windows
  6.3.3 Working with multiple windows
  6.3.4 Dialog windows
 6.4 The Menu
  6.4.1 Accessing the menu
  6.4.2 The File menu
  6.4.3 The Edit menu
  6.4.4 The Search menu
  6.4.5 The Run menu
  6.4.6 The Compile menu
  6.4.7 The Debug menu
  6.4.8 The Tools menu
  6.4.9 The Options menu
  6.4.10 The Window menu
  6.4.11 The Help menu
 6.5 Editing text
  6.5.1 Insert modes
  6.5.2 Blocks
  6.5.3 Setting bookmarks
  6.5.4 Jumping to a source line
  6.5.5 Syntax highlighting
  6.5.6 Code Completion
  6.5.7 Code Templates
 6.6 Searching and replacing
 6.7 The symbol browser
 6.8 Running programs
 6.9 Debugging programs
  6.9.1 Using breakpoints
  6.9.2 Using watches
  6.9.3 The call stack
  6.9.4 The GDB window
 6.10 Using Tools
  6.10.1 The messages window
  6.10.2 Grep
  6.10.3 The ASCII table
  6.10.4 The calculator
  6.10.5 Adding new tools
  6.10.6 Meta parameters
  6.10.7 Building a command line dialog box
 6.11 Project management and compiler options
  6.11.1 The primary file
  6.11.2 The directory dialog
  6.11.3 The target operating system
  6.11.4 Compiler options
  6.11.5 Linker options
  6.11.6 Memory sizes
  6.11.7 Debug options
  6.11.8 The switches mode
 6.12 Customizing the IDE
  6.12.1 Preferences
  6.12.2 The desktop
  6.12.3 The Editor
  6.12.4 Keyboard & Mouse
 6.13 The help system
  6.13.1 Navigating in the help system
  6.13.2 Working with help files
  6.13.3 The about dialog
 6.14 Keyboard shortcuts
7 Porting and portable code
 7.1 Free Pascal compiler modes
 7.2 Turbo Pascal
  7.2.1 Things that will not work
  7.2.2 Things which are extra
  7.2.3 Turbo Pascal compatibility mode
  7.2.4 A note on long file names under dos
 7.3 Porting Delphi code
  7.3.1 Missing language constructs
  7.3.2 Missing calls / API incompatibilities
  7.3.3 Delphi compatibility mode
  7.3.4 Best practices for porting
 7.4 Writing portable code
8 Utilities that come with Free Pascal
 8.1 Demo programs and examples
 8.2 fpcmake
 8.3 fpdoc - Pascal Unit documenter
 8.4 h2pas - C header to Pascal Unit converter
  8.4.1 Options
  8.4.2 Constructs
 8.5 h2paspp - preprocessor for h2pas
  8.5.1 Usage
  8.5.2 Options
 8.6 ppudump program
 8.7 ppumove program
 8.8 ptop - Pascal source beautifier
  8.8.1 ptop program
  8.8.2 The ptop configuration file
  8.8.3 ptopu unit
 8.9 rstconv program
 8.10 unitdiff program
  8.10.1 Synopsis
  8.10.2 Description and usage
  8.10.3 Options
9 Units that come with Free Pascal
 9.1 Standard units
 9.2 Under DOS
 9.3 Under Windows
 9.4 Under Linux and BSD-like platforms
 9.5 Under OS/2
 9.6 Unit availability
10 Debugging your programs
 10.1 Compiling your program with debugger support
 10.2 Using gdb to debug your program
 10.3 Caveats when debugging with gdb
 10.4 Support for gprof, the gnu profiler
 10.5 Detecting heap memory leaks
 10.6 Line numbers in run-time error backtraces
 10.7 Combining heaptrc and lineinfo
A Alphabetical listing of command line options
B Alphabetical list of reserved words
C Compiler messages
 C.1 General compiler messages
 C.2 Scanner messages.
 C.3 Parser messages
 C.4 Type checking errors
 C.5 Symbol handling
 C.6 Code generator messages
 C.7 Errors of assembling/linking stage
 C.8 Executable information messages.
 C.9 Linker messages
 C.10 Unit loading messages.
 C.11 Command line handling errors
 C.12 Whole program optimization messages
 C.13 Package loading messages.
 C.14 Assembler reader errors.
  C.14.1 General assembler errors
  C.14.2 I386 specific errors
  C.14.3 m68k specific errors.
D Run-time errors
E A sample gdb.ini file
F Options and settings
G Getting the latest sources or installers
 G.1 Download via Subversion
 G.2 Downloading a source zip
 G.3 Downloading a snapshot