fpc (1) - Linux Manuals
fpc: Free Pascal Compiler (FPC) binary
NAME
fpc - Free Pascal Compiler (FPC) binarySYNOPSIS
DESCRIPTION
This binary is the main binary of the Free Pascal Compiler (FPC) which is a Turbo Pascal and Delphi (7.0) compatible standalone (non GCC frontend) multitarget Pascal compiler.The compiler uses LD(1) and can use AS(1) (see parameter -Aas), but also has its own binary object writer.
The current main targets are Go32V2 (Dos DJGPP extender), Freebsd, Linux, MacOS, MacOSX, MorphOS, Netware, OS/2 and Win32. The other targets (M68K compilers for Atari and Amiga) are either based on older versions of the compiler or are still in development.
This manpage is meant for quick-reference only. FPC comes with a great (2000+ pages) manual, which is updated constantly, while this man page can be out of date.
Version number
Starting with release 1.0, a new versioning system has been implemented. If the last number is even (1.0, 1.0.2), it is stable, and if the last number is odd it is a daily changing development version.(1.0.5, 1.1) just like the linux kernel.
Version 0.99.5 however is a stable release. It was made before the even/odd version naming system was introduced.
Usage
The compilation proces is started by typing fpc followed by a sourcefile name (normally with .pas or .pp extension). Before processing the actual processing of the source file, fpc.cfg(5) the configuration file of the compiler is read which contains the location of the RTL, other packages (FCL, FreeVision), and optionally default values for some switches. See the separate manpage of fpc.cfg(5) for more information.
Options
General options
- -h
- if you specify this option, the compiler outputs a list of all options, and exits after that.
- -?
- idem as -h, but waiting after every screenfull for the enter key.
- -i
-
This option tells the compiler to print the copyright information.
You can give it an option, as -ixxx where "xxx" can be one of the following:
-
- D
- Returns the compiler date.
- V
- Returns the compiler version.
- SO
- Returns the compiler OS.
- SP
- Returns the compiler processor.
- TO
- Returns the target OS.
- TP
- Returns the target Processor.
-
- -l
- This option tells the compiler to print the FPC logo on standard output. It also gives you the FPC version number.
- -n
-
Tells the compiler not to read the configuration file
fpc.cfg(5)
Options for getting feedback
- -vxxx
-
Be verbose. "xxx" is a combination of the following:
-
- e
- Tells the compiler to show only errors. This option is on by default.
- i
- Tells the compiler to show some general information.
- w
- Tells the compiler to issue warnings.
- n
- Tells the compiler to issue notes.
- h
- Tells the compiler to issue hints.
- l
- Tells the compiler to show the line numbers as it processes a file. Numbers are shown per 100.
- u
- Tells the compiler to print the names of the files it opens.
- t
- Tells the compiler to print the names of the files it tries to open.
- p
- Tells the compiler to print the names of procedures and functions as it is processing them.
- c
- Tells the compiler to warn you when it processes a conditional.
- m
- Tells the compiler to write which macros are defined.
- d
- Tells the compiler to write other debugging info.
- a
- Tells the compiler to write all possible info. (this is the same as specifying all options)
- 0
- Tells the compiler to write no messages. This is useful when you want to override the default setting in the configuration file.
- b
- Tells the compiler to show all procedure declarations if an overloaded function error occurs.
- x
- Tells the compiler to output some executable info (for Win32 platform only).
- r
- Rhide/GCC compatibility mode: formats the error differently, so they are understood by RHIDE.
-
Options concerning files and directories
- -exxx
- tells the compiler that xxx is the directory where it can find the executables as (the assembler) and ld (the linker).
- -FD
- same as -e.
- -Fexxx
- This option tells the compiler to write errors, etc. to the file xxx
- -FExxx
- set the executable/unit output path to xxx
- -Fixxx
- adds xxx to the path where the compiler searches for its include files.
- -Flxxx
- Adds xxx to the library searching path, and is passe to the linker.
- -FLxxx
- ( Linux only) Tells the compiler to use xxx as the dynamic linker. Default this is /lib/ld-linux.so.2, or lib/ld-linux.so.1, depending on which one is found.
- -Foxxx
- Adds xxx to the object file path. This path is used when looking for files that need to be linked in.
- -Frxxx
- tells the compiler that xxx contains the compiler messages. Default the compiler has built-in messages. Specifying this option will override the default messages. (useful if you want to use a language other than the default language).
- -Fuxxx
- Adds xxx to the unit path. By default, the compiler only searches for units in the current directory and the directory where the compiler itself resides. This option tells the compiler also to look in the directory xxx
- -FUxxx
- Tells the compiler to write units in directory xxx instead of the current directory.
- -Ixxx
-
Add
xxx
to the include file search path.
This path is used when looking for include files.
for more information on these options, see also the programmers manual.
- -a
- Tells the compiler not to delete the assembler file. This also counts for the (possibly) generated batch script.
- -al
- Tells the compiler to include the sourcecode lines in the assembler file as comments.
- -an
- Tells the compiler to include node information in the generated assembler file. This is mainly for use by the compiler developers.
- -ap
- Tells the compiler to use pipes to communicate with the assembler.
- -ar
- Tells the compiler to include register allocation/deallocation information.
- -at
- Tells the compiler to include temparary register allocation/deallocation information.
- -Axxx
-
specifies what kind of assembler should be generated . Here
xxx
is one of the following :
-
- AS
- A unix .o (object) file, using GNU AS
- coff
- coff object file (go32) using internal writer.
- default
- Use the default writer for the current platform.
- elf
- elf object file (linux, 32-bit only) using internal writer.
- nasmcoff
- a coff file using the nasm assembler.
- nasmelf
- a ELF32 file (LINUX only) using the nasm assembler.
- nasmobj
- a obj file using the nasm assembler.
- masm
- An obj file using the Microsoft masm assembler.
- pecoff
- pecoff object file (win32) using internal writer.
- tasm
- An obj file using the Borland tasm assembler.
- wasm
- An obj file using the Watcom assembler.
-
- -Ccxxx
- set the default calling convention to XXX.
- -CD
- Create dynamic library.
- -Ce
-
- Compile using emulated floating point instructions.
- -Cfxxx
- Set the used floating point instruction set to xxx.
- -Cg
- Generate PIC code.
- -Chxxx
- Reserves xxx bytes heap. xxx should be between 1024 and 67107840.
- -Ci
- Generate Input/Output checking code.
- -Cn
- Omit the linking stage.
- -Co
- Generate Integer overflow checking code.
- -CR
- Verify object call validity (method calls mustbe valid).
- -Cr
- Generate Range checking code.
- -Csxxx
- Set stack size to xxx bytes.
- -Ct
- generate stack checking code.
- -CX
- Create a smartlinked library.
- -dxxx
-
Define the symbol name
xxx
This can be used to conditionally compile parts of your code.
- -E
- Same as -Cn.
- -g
- Generate debugging information for debugging with GDB
- -gg
- idem as -g.
- -gd
- generate debugging info for dbx.
- -gh
- use the heaptrc unit (see the units part of the FPC manual).
- -gl
- use the lineinfo unit for line information (see the units part of the FPC manual).
- -gv
- Generate information for debugging with valgrind.
- -gw
- Generate DWARF debugging information.
- -Oxxx
-
optimize the compiler's output;
xxx
can have one of the following values :
-
- g
- optimize for size, try to generate smaller code.
- G
- optimize for time, try to generate faster code (default).
- r
- keep certain variables in registers (experimental, use with caution).
- u
- uncertain optimizations
- 1
- Level 1 optimizations (quick optimizations).
- 2
- Level 2 optimizations (-O1 plus some slower optimizations).
- 3
- Level 3 optimizations (-O2 plus -Ou).
- pn
-
Specify processor : n can be one of
-
- 1
- optimize for 386/486
- 2
- optimize for Pentium/PentiumMMX (tm)
- 3
- optimizations for PentiumPro / P-II / Cyrix 6x86 / K6 (tm)
The exact effect of these effects can be found in the programmers part of the manual.
-
-
- -oxxx
- Tells the compiler to use xxx as the name of the output file (executable). Only with programs.
- -pg
- Generate profiler code for gprof.
- -s
- Tells the compiler not to call the assembler and linker. Instead, the compiler writes a script, PPAS.BAT under DOS, or ppas.sh under Linux, which can then be executed to produce an executable.
- -sh
- Tells the compiler to generate a script that can be used to assemble and link on the host system, not on the target system. Use this when cross-compiling.
- -sr
- Skip register allocation stage in compiler (use with -ar)
- -st
- Tells the compiler to generate a script that can be used to assemble and link on the target system, not on the host system. Use this when cross-compiling.
- -Txxx
-
Specifies the target operating system.
xxx
can be one of the following:
-
- EMX
- OS/2 and DOS via the EMX extender.
- FREEBSD
- FreeBSD
- GO32V2
- DOS and version 2 of the DJ DELORIE extender.
- LINUX
- Linux.
- NETBSD
- Netbsd.
- NETWARE
- Novell Netware module (clib)
- NETLIBC
- Novell Netware module (libc)
- OPENBSD
- OpenBSD
- OS2
- OS/2 (native mode)
- SunOS
- Solaris SunOS
- WATCOM
- WatCOM dos extender
- WDOSX
- WDosX Dos extender
- WIN32
- Windows 32 bit.
-
- -uxxx
- undefine the symbol xxx if it is defined. This is the opposite of the -d option.
- -Xx
-
Executable options. These tell the compiler what
kind of executable should be generated. the parameter
x
can be one of the following:
-
- c
- (Linux only, obsolete) Link with the C library. You should only use this when you start to port Free Pascal to another operating system.
- D
- Link with dynamic libraries (defines the FPC_LINK_DYNAMIC symbol)
- d
- Don't use the standard library path. Use this when cross-compiling, to avoid linking with the host OS libraries.
- Pxxx
- Prepend the names of binutils (as, ld) with xxx. For use when cross-compiling.
- rxxx
- Set the library search path to xxx.
- s
- Strip the symbols from the executable.
- S
- Link with static libraries (defines the FPC_LINK_STATIC symbol)
- t
- Link statically (passes -static to the linker)
- X
- Link smart. Using this option sets the FPC_LINK_SMART symbol.
-
Options concerning the sources (language options) for more information on these options, see also in the Programmers Manual
- -Mmode
-
Specify the language mode.
mode
can be one of the following:
-
- delphi
- Delphi-compatibility mode. This loads the objpas unit, and switches on ansistring mode ( -Sh ).
- fpc
- Default mode.
- gpc
- GNU pascal mode (does nothing at the moment)
- macpas
- Mac pascal mode. This loads the macpas unit and switches on some Mac extensions (mainly macros)
- objfpc
- Object Pascal mode. This loads the objpas unit.
- tp
- Turbo Pascal mode.
-
- -Rxxx
-
Specifies what assembler you use in your "asm" assembler code
blocks. Here
xxx
is one of the following:
-
- att
- Asm blocks contain AT&T assembler.
- intel
- Asm blocks contain Intel assembler.
- direct
- Asm blocks should be copied as-is in the assembler file.
-
- -S2
- Switch on Delphi 2 extensions.
- -Sa
- Generate code for assertions.
- -Sc
- Support C-style operators, i.e. *=, +=, /= and -=.
- -Sd
- Tries to be Delphi compatible
- -Se
- The compiler stops after the first error. Normally, the compiler tries to continue compiling after an error, until 50 errors are reached, or a fatal error is reached, and then it stops. With this switch, the compiler will stop after the first error.
- -Sg
- Support the label and goto commands.
- -Sh
- use ansistrings by default.
- -SIxxx
-
Specify the kind of interfaces.
xxx
can be one of the following:
-
- COM
- use COM interfaces. (all interfaces descend from IUnknown)
- CORBA
- use CORBA interfaces. (no inheritance is supposed)
-
- -Si
- Support C++ style INLINE.
- -Sm
- Support C-style macros.
- -So
- Try to be Borland TP 7.0 compatible (no function overloading etc.).
- -Sp
- Try to be GPC (GNU Pascal Compiler) compatible.
- -Ss
- The name of constructors must be "init", and the name of destructors should be "done".
- -St
- Allow the "static" keyword in objects.
- -Un
- Do not check the unit name. Normally, the unit name is the same as the filename. This option allows both to be different.
- -Ur
- Create a release unit. This sets a special flag in the unit, causing the compiler not to look for sources.
- -Us
-
Compile a system unit. This option causes the
compiler to define only some very basic types.