1fpc(1) Free Pascal Compiler fpc(1)
2
3
4
6 fpc - Free Pascal Compiler (FPC) binary
7
8
10 fpc [options] [sourcefile]
11
12
14 This binary is the main binary of the Free Pascal Compiler (FPC) which
15 is a Turbo Pascal and Delphi (7.0) compatible standalone (non GCC
16 frontend) multitarget Pascal compiler.
17
18 The compiler uses LD(1) and can use AS(1) (see parameter -Aas), but
19 also has its own binary object writer.
20
21 The current main targets are Go32V2 (Dos DJGPP extender), Freebsd,
22 Linux, MacOS, MacOSX, MorphOS, Netware, OS/2 and Win32. The other tar‐
23 gets (M68K compilers for Atari and Amiga) are either based on older
24 versions of the compiler or are still in development.
25
26 This manpage is meant for quick-reference only. FPC comes with a great
27 (2000+ pages) manual, which is updated constantly, while this man page
28 can be out of date.
29
30
32 Starting with release 1.0, a new versioning system has been imple‐
33 mented. If the last number is even (1.0, 1.0.2), it is stable, and if
34 the last number is odd it is a daily changing development ver‐
35 sion.(1.0.5, 1.1) just like the linux kernel.
36
37 Version 0.99.5 however is a stable release. It was made before the
38 even/odd version naming system was introduced.
39
40
42 The compilation process is started by typing fpc followed by a source‐
43 file name (normally with .pas or .pp extension). Before processing the
44 actual processing of the source file, fpc.cfg(5) the configuration file
45 of the compiler is read which contains the location of the RTL, other
46 packages (FCL, FreeVision), and optionally default values for some
47 switches. See the separate manpage of fpc.cfg(5) for more information.
48
49
51 General options
52
53
54 -h if you specify this option, the compiler outputs a list of all
55 options, and exits after that.
56
57 -? idem as -h, but waiting after every screenfull for the enter
58 key.
59
60 -i This option tells the compiler to print the copyright informa‐
61 tion.
62
63 You can give it an option, as -ixxx where "xxx" can be one of
64 the following:
65
66 D Returns the compiler date.
67
68 V Returns the compiler version.
69
70 SO Returns the compiler OS.
71
72 SP Returns the compiler processor.
73
74 TO Returns the target OS.
75
76 TP Returns the target Processor.
77
78 -l At the top print a line stating which program this is and its
79 version.
80
81 -n Tells the compiler not to read the configuration file fpc.cfg(5)
82
83
84 Options for getting feedback
85
86 -vxxx Be verbose. "xxx" is a combination of the following:
87
88 e Tells the compiler to show only errors. This option is on
89 by default.
90
91 i Tells the compiler to show some general information.
92
93 w Tells the compiler to issue warnings.
94
95 n Tells the compiler to issue notes.
96
97 h Tells the compiler to issue hints.
98
99 l Tells the compiler to show the line numbers as it pro‐
100 cesses a file. Numbers are shown per 100.
101
102 u Tells the compiler to print the names of the files it
103 opens.
104
105 t Tells the compiler to print the names of the files it
106 tries to open.
107
108 p Tells the compiler to print the names of procedures and
109 functions as it is processing them.
110
111 c Tells the compiler to warn you when it processes a condi‐
112 tional.
113
114 m Tells the compiler to write which macros are defined.
115
116 d Tells the compiler to write other debugging info.
117
118 a Tells the compiler to write all possible info. (this is
119 the same as specifying all options)
120
121 0 Tells the compiler to write no messages. This is useful
122 when you want to override the default setting in the con‐
123 figuration file.
124
125 b Tells the compiler to show all procedure declarations if
126 an overloaded function error occurs.
127
128 x Tells the compiler to output some executable info (for
129 Win32 platform only).
130
131 r Rhide/GCC compatibility mode: formats the error differ‐
132 ently, so they are understood by RHIDE.
133
134 Options concerning files and directories
135
136 -exxx tells the compiler that xxx is the directory where it can find
137 the executables as (the assembler) and ld (the linker).
138
139 -FD same as -e.
140
141 -Fexxx This option tells the compiler to write errors, etc. to the file
142 xxx
143
144 -FExxx set the executable/unit output path to xxx
145
146 -Fixxx adds xxx to the path where the compiler searches for its include
147 files.
148
149 -Flxxx Adds xxx to the library searching path, and is passe to the
150 linker.
151
152 -FLxxx ( Linux only) Tells the compiler to use xxx as the dynamic
153 linker. Default this is /lib/ld-linux.so.2, or lib/ld-
154 linux.so.1, depending on which one is found.
155
156 -Foxxx Adds xxx to the object file path. This path is used when looking
157 for files that need to be linked in.
158
159 -Frxxx tells the compiler that xxx contains the compiler messages. De‐
160 fault the compiler has built-in messages. Specifying this option
161 will override the default messages. (useful if you want to use
162 a language other than the default language).
163
164 -Fuxxx Adds xxx to the unit path. By default, the compiler only
165 searches for units in the current directory and the directory
166 where the compiler itself resides. This option tells the com‐
167 piler also to look in the directory xxx
168
169 -FUxxx Tells the compiler to write units in directory xxx instead of
170 the current directory.
171
172 -Ixxx Add xxx to the include file search path. This path is used when
173 looking for include files.
174
175
176 Options controlling the kind of output for more information on these
177 options, see also the programmers manual.
178
179 -a Tells the compiler not to delete the assembler file. This also
180 counts for the (possibly) generated batch script.
181
182 -al Tells the compiler to include the sourcecode lines in the assem‐
183 bler file as comments.
184
185 -an Tells the compiler to include node information in the generated
186 assembler file. This is mainly for use by the compiler develop‐
187 ers.
188
189 -ap Tells the compiler to use pipes to communicate with the assem‐
190 bler.
191
192 -ar Tells the compiler to include register allocation/deallocation
193 information.
194
195 -at Tells the compiler to include temporary register allocation/de‐
196 allocation information.
197
198 -Axxx specifies what kind of assembler should be generated . Here xxx
199 is one of the following :
200
201 AS A unix .o (object) file, using GNU AS
202
203 coff coff object file (go32) using internal writer.
204
205 default
206 Use the default writer for the current platform.
207
208 elf elf object file (linux, 32-bit only) using internal
209 writer.
210
211 nasmcoff
212 a coff file using the nasm assembler.
213
214 nasmelf
215 a ELF32 file (LINUX only) using the nasm assembler.
216
217 nasmobj
218 a obj file using the nasm assembler.
219
220 masm An obj file using the Microsoft masm assembler.
221
222 pecoff pecoff object file (win32) using internal writer.
223
224 tasm An obj file using the Borland tasm assembler.
225
226 wasm An obj file using the Watcom assembler.
227
228 -Ccxxx set the default calling convention to XXX.
229
230 -CD Create dynamic library.
231
232
233 -Ce Compile using emulated floating point instructions.
234
235 -Cfxxx Set the used floating point instruction set to xxx.
236
237 -Cg Generate PIC code.
238
239 -Chxxx Reserves xxx bytes heap. xxx should be between 1024 and
240 67107840.
241
242 -Ci Generate Input/Output checking code.
243
244 -Cn Omit the linking stage.
245
246 -Co Generate Integer overflow checking code.
247
248 -CR Verify object call validity (method calls mustbe valid).
249
250 -Cr Generate Range checking code.
251
252 -Csxxx Set stack size to xxx bytes.
253
254 -Ct generate stack checking code.
255
256 -CX Create a smartlinked library.
257
258 -dxxx Define the symbol name xxx This can be used to conditionally
259 compile parts of your code.
260
261
262 -E Same as -Cn.
263
264 -g Generate debugging information for debugging with GDB
265
266 -gg idem as -g.
267
268 -gd generate debugging info for dbx.
269
270 -gh use the heaptrc unit (see the units part of the FPC manual).
271
272 -gl use the lineinfo unit for line information (see the units part
273 of the FPC manual).
274
275 -gv Generate information for debugging with valgrind.
276
277 -gw Generate DWARF debugging information.
278
279 -Oxxx optimize the compiler's output; xxx can have one of the follow‐
280 ing values :
281
282 g optimize for size, try to generate smaller code.
283
284 G optimize for time, try to generate faster code (default).
285
286 r keep certain variables in registers (experimental, use
287 with caution).
288
289 u uncertain optimizations
290
291 1 Level 1 optimizations (quick optimizations).
292
293 2 Level 2 optimizations (-O1 plus some slower optimiza‐
294 tions).
295
296 3 Level 3 optimizations (-O2 plus -Ou).
297
298 pn Specify processor : n can be one of
299
300 1 optimize for 386/486
301
302 2 optimize for Pentium/PentiumMMX (tm)
303
304 3 optimizations for PentiumPro / P-II / Cyrix 6x86 /
305 K6 (tm)
306
307 The exact effect of these effects can be found in the program‐
308 mers part of the manual.
309
310 -oxxx Tells the compiler to use xxx as the name of the output file
311 (executable). Only with programs.
312
313 -pg Generate profiler code for gprof.
314
315 -s Tells the compiler not to call the assembler and linker. In‐
316 stead, the compiler writes a script, PPAS.BAT under DOS, or
317 ppas.sh under Linux, which can then be executed to produce an
318 executable.
319
320 -sh Tells the compiler to generate a script that can be used to as‐
321 semble and link on the host system, not on the target system.
322 Use this when cross-compiling.
323
324 -sr Skip register allocation stage in compiler (use with -ar)
325
326 -st Tells the compiler to generate a script that can be used to as‐
327 semble and link on the target system, not on the host system.
328 Use this when cross-compiling.
329
330 -Txxx Specifies the target operating system. xxx can be one of the
331 following:
332
333 EMX OS/2 and DOS via the EMX extender.
334
335 FREEBSD
336 FreeBSD
337
338 GO32V2 DOS and version 2 of the DJ DELORIE extender.
339
340 LINUX Linux.
341
342 NETBSD Netbsd.
343
344 NETWARE
345 Novell Netware module (clib)
346
347 NETLIBC
348 Novell Netware module (libc)
349
350 OPENBSD
351 OpenBSD
352
353 OS2 OS/2 (native mode)
354
355 SunOS Solaris SunOS
356
357 WATCOM WatCOM dos extender
358
359 WDOSX WDosX Dos extender
360
361 WIN32 Windows 32 bit.
362
363 -uxxx undefine the symbol xxx if it is defined. This is the opposite
364 of the -d option.
365
366 -Xx Executable options. These tell the compiler what kind of exe‐
367 cutable should be generated. the parameter x can be one of the
368 following:
369
370 c (Linux only, obsolete) Link with the C library. You
371 should only use this when you start to port Free Pascal
372 to another operating system.
373
374 D Link with dynamic libraries (defines the FPC_LINK_DYNAMIC
375 symbol)
376
377 d Don't use the standard library path. Use this when cross-
378 compiling, to avoid linking with the host OS libraries.
379
380 Pxxx Prepend the names of binutils (as, ld) with xxx. For use
381 when cross-compiling.
382
383 rxxx Set the library search path to xxx.
384
385 s Strip the symbols from the executable.
386
387 S Link with static libraries (defines the FPC_LINK_STATIC
388 symbol)
389
390 t Link statically (passes -static to the linker)
391
392 X Link smart. Using this option sets the FPC_LINK_SMART
393 symbol.
394
395
396 Options concerning the sources (language options) for more information
397 on these options, see also in the Programmers Manual
398
399 -Mmode Specify the language mode. mode can be one of the following:
400
401 delphi Delphi-compatibility mode. This loads the objpas unit,
402 and switches on ansistring mode ( -Sh ).
403
404 fpc Default mode.
405
406 gpc GNU pascal mode (does nothing at the moment)
407
408 macpas Mac pascal mode. This loads the macpas unit and switches
409 on some Mac extensions (mainly macros)
410
411 objfpc Object Pascal mode. This loads the objpas unit.
412
413 tp Turbo Pascal mode.
414
415 -Rxxx Specifies what assembler you use in your "asm" assembler code
416 blocks. Here xxx is one of the following:
417
418 att Asm blocks contain AT&T assembler.
419
420 intel Asm blocks contain Intel assembler.
421
422 default
423 Use default assembler for the selected platform.
424
425 -S2 Switch on Delphi 2 extensions.
426
427 -Sa Generate code for assertions.
428
429 -Sc Support C-style operators, i.e. *=, +=, /= and -=.
430
431 -Sd Tries to be Delphi compatible
432
433 -Se The compiler stops after the first error. Normally, the compiler
434 tries to continue compiling after an error, until 50 errors are
435 reached, or a fatal error is reached, and then it stops. With
436 this switch, the compiler will stop after the first error.
437
438 -Sg Support the label and goto commands.
439
440 -Sh use ansistrings by default.
441
442 -SIxxx Specify the kind of interfaces. xxx can be one of the follow‐
443 ing:
444
445 COM use COM interfaces. (all interfaces descend from IUn‐
446 known)
447
448 CORBA use CORBA interfaces. (no inheritance is supposed)
449
450 -Si Support C++ style INLINE.
451
452 -Sm Support C-style macros.
453
454 -So Try to be Borland TP 7.0 compatible (no function overloading
455 etc.).
456
457 -Sp Try to be GPC (GNU Pascal Compiler) compatible.
458
459 -Ss The name of constructors must be "init", and the name of de‐
460 structors should be "done".
461
462 -St Allow the "static" keyword in objects.
463
464 -Un Do not check the unit name. Normally, the unit name is the same
465 as the filename. This option allows both to be different.
466
467 -Ur Create a release unit. This sets a special flag in the unit,
468 causing the compiler not to look for sources.
469
470 -Us Compile a system unit. This option causes the compiler to define
471 only some very basic types.
472
473
475 fpc.cfg(5) ppdep(1) ppudump(1) ppumove(1) ptop(1) h2pas(1) ld(1) as(1)
476
477
478
479Free Pascal 22 feb 2002 fpc(1)