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 fron‐
16 tend) 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 proces 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 This option tells the compiler to print the FPC logo on standard
79 output. It also gives you the FPC version number.
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.
160 Default the compiler has built-in messages. Specifying this
161 option will override the default messages. (useful if you want
162 to use 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 for more information on these options, see also the programmers manual.
177
178 -a Tells the compiler not to delete the assembler file. This also
179 counts for the (possibly) generated batch script.
180
181 -al Tells the compiler to include the sourcecode lines in the assem‐
182 bler file as comments.
183
184 -an Tells the compiler to include node information in the generated
185 assembler file. This is mainly for use by the compiler develop‐
186 ers.
187
188 -ap Tells the compiler to use pipes to communicate with the assem‐
189 bler.
190
191 -ar Tells the compiler to include register allocation/deallocation
192 information.
193
194 -at Tells the compiler to include temparary register alloca‐
195 tion/deallocation information.
196
197 -Axxx specifies what kind of assembler should be generated . Here xxx
198 is one of the following :
199
200 AS A unix .o (object) file, using GNU AS
201
202 coff coff object file (go32) using internal writer.
203
204 default
205 Use the default writer for the current platform.
206
207 elf elf object file (linux, 32-bit only) using internal
208 writer.
209
210 nasmcoff
211 a coff file using the nasm assembler.
212
213 nasmelf
214 a ELF32 file (LINUX only) using the nasm assembler.
215
216 nasmobj
217 a obj file using the nasm assembler.
218
219 masm An obj file using the Microsoft masm assembler.
220
221 pecoff pecoff object file (win32) using internal writer.
222
223 tasm An obj file using the Borland tasm assembler.
224
225 wasm An obj file using the Watcom assembler.
226
227 -Ccxxx set the default calling convention to XXX.
228
229 -CD Create dynamic library.
230
231
232 -Ce Compile using emulated floating point instructions.
233
234 -Cfxxx Set the used floating point instruction set to xxx.
235
236 -Cg Generate PIC code.
237
238 -Chxxx Reserves xxx bytes heap. xxx should be between 1024 and
239 67107840.
240
241 -Ci Generate Input/Output checking code.
242
243 -Cn Omit the linking stage.
244
245 -Co Generate Integer overflow checking code.
246
247 -CR Verify object call validity (method calls mustbe valid).
248
249 -Cr Generate Range checking code.
250
251 -Csxxx Set stack size to xxx bytes.
252
253 -Ct generate stack checking code.
254
255 -CX Create a smartlinked library.
256
257 -dxxx Define the symbol name xxx This can be used to condition‐
258 ally compile parts of your code.
259
260
261 -E Same as -Cn.
262
263 -g Generate debugging information for debugging with GDB
264
265 -gg idem as -g.
266
267 -gd generate debugging info for dbx.
268
269 -gh use the heaptrc unit (see the units part of the FPC man‐
270 ual).
271
272 -gl use the lineinfo unit for line information (see the units
273 part 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
280 following values :
281
282 g optimize for size, try to generate smaller code.
283
284 G optimize for time, try to generate faster code
285 (default).
286
287 r keep certain variables in registers (experimental,
288 use with caution).
289
290 u uncertain optimizations
291
292 1 Level 1 optimizations (quick optimizations).
293
294 2 Level 2 optimizations (-O1 plus some slower opti‐
295 mizations).
296
297 3 Level 3 optimizations (-O2 plus -Ou).
298
299 pn Specify processor : n can be one of
300
301 1 optimize for 386/486
302
303 2 optimize for Pentium/PentiumMMX (tm)
304
305 3 optimizations for PentiumPro / P-II / Cyrix
306 6x86 / K6 (tm)
307
308 The exact effect of these effects can be found in the
309 programmers part of the manual.
310
311 -oxxx Tells the compiler to use xxx as the name of the output
312 file (executable). Only with programs.
313
314 -pg Generate profiler code for gprof.
315
316 -s Tells the compiler not to call the assembler and linker.
317 Instead, the compiler writes a script, PPAS.BAT under
318 DOS, or ppas.sh under Linux, which can then be executed
319 to produce an executable.
320
321 -sh Tells the compiler to generate a script that can be used
322 to assemble and link on the host system, not on the tar‐
323 get system. Use this when cross-compiling.
324
325 -sr Skip register allocation stage in compiler (use with -ar)
326
327 -st Tells the compiler to generate a script that can be used
328 to assemble and link on the target system, not on the
329 host system. Use this when cross-compiling.
330
331 -Txxx Specifies the target operating system. xxx can be one of
332 the following:
333
334 EMX OS/2 and DOS via the EMX extender.
335
336 FREEBSD
337 FreeBSD
338
339 GO32V2 DOS and version 2 of the DJ DELORIE extender.
340
341 LINUX Linux.
342
343 NETBSD Netbsd.
344
345 NETWARE
346 Novell Netware module (clib)
347
348 NETLIBC
349 Novell Netware module (libc)
350
351 OPENBSD
352 OpenBSD
353
354 OS2 OS/2 (native mode)
355
356 SunOS Solaris SunOS
357
358 WATCOM WatCOM dos extender
359
360 WDOSX WDosX Dos extender
361
362 WIN32 Windows 32 bit.
363
364 -uxxx undefine the symbol xxx if it is defined. This is the
365 opposite of the -d option.
366
367 -Xx Executable options. These tell the compiler what kind of
368 executable should be generated. the parameter x can be
369 one of the following:
370
371 c (Linux only, obsolete) Link with the C library.
372 You should only use this when you start to port
373 Free Pascal to another operating system.
374
375 D Link with dynamic libraries (defines the
376 FPC_LINK_DYNAMIC symbol)
377
378 d Don't use the standard library path. Use this when
379 cross-compiling, to avoid linking with the host OS
380 libraries.
381
382 Pxxx Prepend the names of binutils (as, ld) with xxx.
383 For use when cross-compiling.
384
385 rxxx Set the library search path to xxx.
386
387 s Strip the symbols from the executable.
388
389 S Link with static libraries (defines the
390 FPC_LINK_STATIC symbol)
391
392 t Link statically (passes -static to the linker)
393
394 X Link smart. Using this option sets the
395 FPC_LINK_SMART symbol.
396
397
398 Options concerning the sources (language options) for more
399 information on these options, see also in the Programmers Manual
400
401 -Mmode Specify the language mode. mode can be one of the fol‐
402 lowing:
403
404 delphi Delphi-compatibility mode. This loads the objpas
405 unit, and switches on ansistring mode ( -Sh ).
406
407 fpc Default mode.
408
409 gpc GNU pascal mode (does nothing at the moment)
410
411 macpas MAC pascal mode. This loads the macpas unit and
412 switches on some Mac extensions (mainly macros)
413
414 objfpc Object Pascal mode. This loads the objpas unit.
415
416 tp Turbo Pascal mode.
417
418 -Rxxx Specifies what assembler you use in your "asm" assembler
419 code blocks. Here xxx is one of the following:
420
421 att Asm blocks contain AT&T assembler.
422
423 intel Asm blocks contain Intel assembler.
424
425 direct Asm blocks should be copied as-is in the assembler
426 file.
427
428 -S2 Switch on Delphi 2 extensions.
429
430 -Sa Generate code for assertions.
431
432 -Sc Support C-style operators, i.e. *=, +=, /= and -=.
433
434 -Sd Tries to be Delphi compatible
435
436 -Se The compiler stops after the first error. Normally, the
437 compiler tries to continue compiling after an error,
438 until 50 errors are reached, or a fatal error is reached,
439 and then it stops. With this switch, the compiler will
440 stop after the first error.
441
442 -Sg Support the label and goto commands.
443
444 -Sh use ansistrings by default.
445
446 -SIxxx Specify the kind of interfaces. xxx can be one of the
447 following:
448
449 COM use COM interfaces. (all interfaces descend from
450 IUnknown)
451
452 CORBA use CORBA interfaces. (no inheritance is supposed)
453
454 -Si Support C++ style INLINE.
455
456 -Sm Support C-style macros.
457
458 -So Try to be Borland TP 7.0 compatible (no function over‐
459 loading etc.).
460
461 -Sp Try to be GPC (GNU Pascal Compiler) compatible.
462
463 -Ss The name of constructors must be "init", and the name of
464 destructors should be "done".
465
466 -St Allow the "static" keyword in objects.
467
468 -Un Do not check the unit name. Normally, the unit name is
469 the same as the filename. This option allows both to be
470 different.
471
472 -Ur Create a release unit. This sets a special flag in the
473 unit, causing the compiler not to look for sources.
474
475 -Us Compile a system unit. This option causes the compiler to
476 define only some very basic types.
477
478
480 fpc.cfg(5) ppdep(1) ppudump(1) ppumove(1) ptop(1) h2pas(1) ld(1)
481 as(1)
482
483
484
485Free Pascal 22 feb 2002 fpc(1)