fpc.1 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. .TH fpc 1 "22 feb 2002" "Free Pascal" "Free Pascal Compiler"
  2. .SH NAME
  3. fpc \- Free Pascal Compiler (FPC) binary
  4. .SH SYNOPSIS
  5. .B "fpc [options] [sourcefile]"
  6. .BR
  7. .SH DESCRIPTION
  8. This binary is the main binary of the
  9. .I Free Pascal Compiler (FPC)
  10. which is a
  11. .I Turbo Pascal
  12. and
  13. .I Delphi (5.0)
  14. compatible standalone (non GCC frontend) multitarget Pascal compiler.
  15. .PP
  16. The compiler uses
  17. .BR LD (1)
  18. and can use
  19. .BR AS (1)
  20. (see parameter \-Aas), but also has its own binary object writer.
  21. .PP
  22. The current main targets are
  23. .I Go32V2
  24. (Dos DJGPP extender),
  25. .I Freebsd,
  26. .I OpenBSD,
  27. .I NetBSD,
  28. .I Linux,
  29. .I OS/2,
  30. .I BeOS,
  31. .I Netware,
  32. .I Solaris
  33. and
  34. .I Win32.
  35. The other targets (M68K compilers for Atari and Amiga) are either based on older
  36. versions of the compiler or are still in development.
  37. .PP
  38. This manpage is meant for quick\-reference only. FPC comes with a great (2000+ pages)
  39. manual, which is updated constantly, while this man page can be out of date.
  40. .SH Version number
  41. Starting with release 1.0, a new versioning system has been implemented.
  42. If the last number is even (1.0, 1.0.2), it is stable, and if the last number is
  43. odd it is a daily changing development version.(1.0.5, 1.1) just like the linux kernel.
  44. .PP
  45. Version 0.99.5 however is a stable release. It was made before the even/odd version
  46. naming system was introduced.
  47. .SH Usage
  48. The compilation proces is started by typing
  49. .I fpc
  50. followed by a sourcefile name (normally with .pas or .pp extension). Before processing the actual processing of the source file,
  51. .BR fpc.cfg (5)
  52. the configuration file of the compiler is read which contains the location of the
  53. RTL, other packages (FCL, FreeVision), and optionally default values for some
  54. switches. See the separate manpage of
  55. .BR fpc.cfg (5)
  56. for more information.
  57. .SH Options
  58. .PP
  59. General options
  60. .TP
  61. .BI \-h
  62. if you specify this option, the compiler outputs a list of all options,
  63. and exits after that.
  64. .TP
  65. .BI \-?
  66. idem as \-h, but waiting after every screenfull for the enter key.
  67. .TP
  68. .BI \-i
  69. This option tells the compiler to print the copyright information.
  70. You can give it an option, as -ixxx} where "xxx" can be one of the
  71. following:
  72. .RS
  73. .TP
  74. .I D
  75. Returns the compiler date.
  76. .TP
  77. .I V
  78. Returns the compiler version.
  79. .TP
  80. .I SO
  81. Returns the compiler OS.
  82. .TP
  83. .I SP
  84. Returns the compiler processor.
  85. .TP
  86. .I TO
  87. Returns the target OS.
  88. .TP
  89. .I TP
  90. Returns the target Processor.
  91. .RE
  92. .TP
  93. .I -l
  94. This option tells the compiler to print the
  95. .I FPC
  96. logo on standard output. It also gives you the
  97. .I FPC
  98. version number.
  99. .TP
  100. .I -n
  101. Tells the compiler not to read the configuration file
  102. .BR fpc.cfg (5)
  103. .PP
  104. Options for getting feedback
  105. .TP
  106. .BI \-v xxx
  107. Be verbose. "xxx" is a combination of the following:
  108. .RS
  109. .TP
  110. .I e
  111. Tells the compiler to show only errors. This option is on by default.
  112. .TP
  113. .I i
  114. Tells the compiler to show some general information.
  115. .TP
  116. .I w
  117. Tells the compiler to issue warnings.
  118. .TP
  119. .I n
  120. Tells the compiler to issue notes.
  121. .TP
  122. .I h
  123. Tells the compiler to issue hints.
  124. .TP
  125. .I l
  126. Tells the compiler to show the line numbers as it processes a
  127. file. Numbers are shown per 100.
  128. .TP
  129. .I u
  130. Tells the compiler to print the names of the files it opens.
  131. .TP
  132. .I t
  133. Tells the compiler to print the names of the files it tries
  134. to open.
  135. .TP
  136. .I p
  137. Tells the compiler to print the names of procedures and
  138. functions as it is processing them.
  139. .TP
  140. .I c
  141. Tells the compiler to warn you when it processes a
  142. conditional.
  143. .TP
  144. .I m
  145. Tells the compiler to write which macros are defined.
  146. .TP
  147. .I d
  148. Tells the compiler to write other debugging info.
  149. .TP
  150. .I a
  151. Tells the compiler to write all possible info. (this is the
  152. same as specifying all options)
  153. .TP
  154. .I 0
  155. Tells the compiler to write no messages. This is useful when
  156. you want to override the default setting in the configuration file.
  157. .TP
  158. .I b
  159. Tells the compiler to show all procedure declarations if an
  160. overloaded function error occurs.
  161. .TP
  162. .I x
  163. Tells the compiler to output some executable info (for Win32
  164. platform only).
  165. .TP
  166. .I r
  167. Rhide/GCC compatibility mode: formats the error differently, so they
  168. are understood by RHIDE.
  169. .RE
  170. .PP
  171. Options concerning files and directories
  172. .TP
  173. .BI -e xxx
  174. tells the compiler that
  175. .I xxx
  176. is the directory where it can find the executables as (the assembler) and
  177. ld (the linker).
  178. .TP
  179. .BI \-FD
  180. same as
  181. .I \-e.
  182. .TP
  183. .BI \-Fe xxx
  184. This option tells the compiler to write errors, etc. to
  185. the file
  186. .I xxx
  187. .
  188. .TP
  189. .BI \-FE xxx
  190. set the executable/unit output path to
  191. .I xxx
  192. .
  193. .TP
  194. .BI \-Fi xxx
  195. adds
  196. .I xxx
  197. to the path where the compiler searches for its include files.
  198. .TP
  199. .BI \-Fl xxx
  200. Adds
  201. .I xxx
  202. to the library searching path, and is passe to the linker.
  203. .TP
  204. .BI \-FL xxx
  205. ( Linux only) Tells the compiler to use
  206. .I xxx
  207. as the dynamic linker. Default this is /lib/ld-linux.so.2, or
  208. lib/ld-linux.so.1, depending on which one is found.
  209. .TP
  210. .BI \-Fo xxx
  211. Adds
  212. .I xxx
  213. to the object file path. This path is used
  214. when looking for files that need to be linked in.
  215. .TP
  216. .BI \-Fr xxx
  217. tells the compiler that
  218. .I xxx
  219. contains the compiler messages. Default the compiler has built-in
  220. messages. Specifying this option will override the default messages.
  221. (useful if you want to use a language other than the default language).
  222. .TP
  223. .BI \-Fu xxx
  224. Adds
  225. .I xxx
  226. to the unit path.
  227. By default, the compiler only searches for units in the current directory
  228. and the directory where the compiler itself resides. This option tells the
  229. compiler also to look in the directory
  230. .I xxx
  231. .
  232. .TP
  233. .BI \-FU xxx
  234. Tells the compiler to write units in directory
  235. .I xxx
  236. instead of the current directory.
  237. .TP
  238. .BI \-I xxx
  239. Add
  240. .I xxx
  241. to the include file search path.
  242. This path is used when looking for include files.
  243. .PP Options controlling the kind of output
  244. for more information on these options, see also the programmers manual.
  245. .TP
  246. .BI \-a
  247. Tells the compiler not to delete the assembler file.
  248. This also counts for the (possibly) generated batch script.
  249. .TP
  250. .BI \-al
  251. Tells the compiler to include the sourcecode lines
  252. in the assembler file as comments.
  253. .TP
  254. .BI \-an
  255. Tells the compiler to include node information in the generated assembler file.
  256. This is mainly for use by the compiler developers.
  257. .TP
  258. .BI \-ap
  259. Tells the compiler to use pipes to communicate with the assembler.
  260. .TP
  261. .BI \-ar
  262. Tells the compiler to include register allocation/deallocation information.
  263. .TP
  264. .BI \-at
  265. Tells the compiler to include temparary register allocation/deallocation information.
  266. .TP
  267. .BI -A xxx
  268. specifies what kind of assembler should be generated . Here
  269. .I xxx
  270. is one of the following :
  271. .RS
  272. .TP
  273. .I AS
  274. A unix .o (object) file, using
  275. .I GNU AS
  276. .TP
  277. .I coff
  278. coff object file (go32) using internal writer.
  279. .TP
  280. .I default
  281. Use the default writer for the current platform.
  282. .TP
  283. .I elf
  284. elf object file (linux, 32-bit only) using internal writer.
  285. .TP
  286. .I nasmcoff
  287. a coff file using the
  288. .I nasm
  289. assembler.
  290. .TP
  291. .I nasmelf
  292. a ELF32 file (LINUX only) using the
  293. .I nasm
  294. assembler.
  295. .TP
  296. .I nasmobj
  297. a obj file using the
  298. .I nasm
  299. assembler.
  300. .TP
  301. .I masm
  302. An obj file using the Microsoft
  303. .I masm
  304. assembler.
  305. .TP
  306. .I pecoff
  307. pecoff object file (win32) using internal writer.
  308. .TP
  309. .I tasm
  310. An obj file using the Borland
  311. .I tasm
  312. assembler.
  313. .TP
  314. .I wasm
  315. An obj file using the Watcom assembler.
  316. .RE
  317. .TP
  318. .BI \-Ccxxx
  319. set the default calling convention to XXX.
  320. .TP
  321. .BI \-CD
  322. Create dynamic library.
  323. .TP
  324. .TP
  325. .BI \-Ce
  326. Compile using emulated floating point instructions.
  327. .TP
  328. .BI \-Cfxxx
  329. Set the used floating point instruction set to xxx.
  330. .TP
  331. .BI \-Cg
  332. Generate PIC code.
  333. .TP
  334. .BI \-Ch xxx
  335. Reserves
  336. .I xxx
  337. bytes heap.
  338. .I xxx
  339. should be between 1024 and 67107840.
  340. .TP
  341. .BI \-Ci
  342. Generate Input/Output checking code.
  343. .TP
  344. .BI \-Cn
  345. Omit the linking stage.
  346. .TP
  347. .BI \-Co
  348. Generate Integer overflow checking code.
  349. .TP
  350. .BI \-CR
  351. Verify object call validity (method calls mustbe valid).
  352. .TP
  353. .BI \-Cr
  354. Generate Range checking code.
  355. .TP
  356. .BI \-Cs xxx
  357. Set stack size to
  358. .I xxx
  359. bytes.
  360. .TP
  361. .BI \-Ct
  362. generate stack checking code.
  363. .TP
  364. .BI \-CX
  365. Create a smartlinked library.
  366. .TP
  367. .BI \-d xxx
  368. Define the symbol name
  369. .I xxx
  370. This can be used to conditionally compile parts of your code.
  371. .TP
  372. .BI \-E
  373. Same as -Cn.
  374. .TP
  375. .BI \-g
  376. Generate debugging information for debugging with
  377. .I GDB
  378. .
  379. .TP
  380. .BI \-gg
  381. idem as
  382. .B -g.
  383. .TP
  384. .BI \-gd
  385. generate debugging info for dbx.
  386. .TP
  387. .BI \-gh
  388. use the heaptrc unit (see the units part of the FPC manual).
  389. .TP
  390. .BI \-gl
  391. use the lineinfo unit for line information (see the units part of the FPC manual).
  392. .TP
  393. .BI \-gv
  394. Generate information for debugging with valgrind.
  395. .TP
  396. .BI \-gw
  397. Generate DWARF debugging information.
  398. .TP
  399. .BI \-O xxx
  400. optimize the compiler's output;
  401. .I xxx
  402. can have one of the following values :
  403. .RS
  404. .TP
  405. .I g
  406. optimize for size, try to generate smaller code.
  407. .TP
  408. .I G
  409. optimize for time, try to generate faster code (default).
  410. .TP
  411. .I r
  412. keep certain variables in registers (experimental, use with caution).
  413. .TP
  414. .I u
  415. uncertain optimizations
  416. .TP
  417. .I 1
  418. Level 1 optimizations (quick optimizations).
  419. .TP
  420. .I 2
  421. Level 2 optimizations (-O1 plus some slower optimizations).
  422. .TP
  423. .I 3
  424. Level 3 optimizations (-O2 plus -Ou).
  425. .TP
  426. .I pn
  427. Specify processor : n can be one of
  428. .RS
  429. .TP
  430. .I 1
  431. optimize for 386/486
  432. .TP
  433. .I 2
  434. optimize for Pentium/PentiumMMX (tm)
  435. .TP
  436. .I 3
  437. optimizations for PentiumPro / P-II / Cyrix 6x86 / K6 (tm)
  438. .RE
  439. The exact effect of these effects can be found in the programmers part of the manual.
  440. .RE
  441. .TP
  442. .BI \-o xxx
  443. Tells the compiler to use
  444. .I xxx
  445. as the name of the output file (executable). Only with programs.
  446. .TP
  447. .BI \-pg
  448. Generate profiler code for gprof.
  449. .TP
  450. .BI \-s
  451. Tells the compiler not to call the assembler and linker.
  452. Instead, the compiler writes a script, PPAS.BAT under DOS, or
  453. ppas.sh under Linux, which can then be executed to produce an
  454. executable.
  455. .TP
  456. .BI \-sh
  457. Tells the compiler to generate a script that can be used to assemble
  458. and link on the host system, not on the target system. Use this when
  459. cross-compiling.
  460. .TP
  461. .BI \-sr
  462. Skip register allocation stage in compiler (use with -ar)
  463. .TP
  464. .BI \-st
  465. Tells the compiler to generate a script that can be used to assemble
  466. and link on the target system, not on the host system. Use this when
  467. cross-compiling.
  468. .TP
  469. .BI \-T xxx
  470. Specifies the target operating system.
  471. .I xxx
  472. can be one of the following:
  473. .RS
  474. .TP
  475. .I EMX
  476. OS/2 and DOS via the EMX extender.
  477. .TP
  478. .I FREEBSD
  479. FreeBSD
  480. .TP
  481. .I GO32V2
  482. DOS and version 2 of the DJ DELORIE extender.
  483. .TP
  484. .I LINUX
  485. Linux.
  486. .TP
  487. .I NETBSD
  488. Netbsd.
  489. .TP
  490. .I NETWARE
  491. Novell Netware module (clib)
  492. .TP
  493. .I NETLIBC
  494. Novell Netware module (libc)
  495. .TP
  496. .I OPENBSD
  497. OpenBSD
  498. .TP
  499. .I OS2
  500. OS/2 (native mode)
  501. .TP
  502. .I SunOS
  503. Solaris SunOS
  504. .TP
  505. .I WATCOM
  506. WatCOM dos extender
  507. .TP
  508. .I WDOSX
  509. WDosX Dos extender
  510. .TP
  511. .I WIN32
  512. Windows 32 bit.
  513. .RE
  514. .TP
  515. .BI -u xxx
  516. undefine the symbol
  517. .I xxx
  518. if it is defined. This is the opposite of the
  519. .B \-d
  520. option.
  521. .TP
  522. .BI \-X x
  523. Executable options. These tell the compiler what
  524. kind of executable should be generated. the parameter
  525. .I x
  526. can be one of the following:
  527. .RS
  528. .TP
  529. .I c
  530. (Linux only, obsolete) Link with the C library. You should only use this when
  531. you start to port Free Pascal to another operating system.
  532. .TP
  533. .I D
  534. Link with dynamic libraries (defines the FPC_LINK_DYNAMIC symbol)
  535. .TP
  536. .I d
  537. Don't use the standard library path. Use this when cross-compiling, to avoid
  538. linking with the host OS libraries.
  539. .TP
  540. .I Pxxx
  541. Prepend the names of binutils (as, ld) with xxx. For use when cross-compiling.
  542. .TP
  543. .I rxxx
  544. Set the library search path to xxx.
  545. .TP
  546. .I s
  547. Strip the symbols from the executable.
  548. .TP
  549. .I S
  550. Link with static libraries (defines the FPC_LINK_STATIC symbol)
  551. .TP
  552. .I t
  553. Link statically (passes -static to the linker)
  554. .TP
  555. .I X
  556. Link smart. Using this option sets the FPC_LINK_SMART symbol.
  557. .RE
  558. .PP
  559. Options concerning the sources (language options)
  560. for more information on these options, see also in the Programmers Manual
  561. .TP
  562. .BI \-M mode
  563. Specify the language mode.
  564. .I mode
  565. can be one of the following:
  566. .RS
  567. .TP
  568. .I delphi
  569. Delphi-compatibility mode. This loads the objpas unit, and switches on ansistring mode (
  570. .B -Sh
  571. ).
  572. .TP
  573. .I fpc
  574. Default mode.
  575. .TP
  576. .I gpc
  577. GNU pascal mode (does nothing at the moment)
  578. .TP
  579. .I macpas
  580. MAC pascal mode. This loads the macpas unit and switches on some Mac extensions
  581. (mainly macros)
  582. .TP
  583. .I objfpc
  584. Object Pascal mode. This loads the objpas unit.
  585. .TP
  586. .I tp
  587. Turbo Pascal mode.
  588. .RE
  589. .TP
  590. .BI \-R xxx
  591. Specifies what assembler you use in your "asm" assembler code
  592. blocks. Here
  593. .I xxx
  594. is one of the following:
  595. .RS
  596. .TP
  597. .I att
  598. Asm blocks contain AT&T assembler.
  599. .TP
  600. .I intel
  601. Asm blocks contain Intel assembler.
  602. .TP
  603. .I direct
  604. Asm blocks should be copied as-is in the assembler
  605. file.
  606. .RE
  607. .TP
  608. .BI \-S2
  609. Switch on Delphi 2 extensions.
  610. .TP
  611. .BI \-Sa
  612. Generate code for assertions.
  613. .TP
  614. .BI \-Sc
  615. Support C-style operators, i.e. *=, +=, /= and -=.
  616. .TP
  617. .BI \-Sd
  618. Tries to be Delphi compatible
  619. .TP
  620. .BI \-Se
  621. The compiler stops after the first error. Normally,
  622. the compiler tries to continue compiling after an error, until 50 errors are
  623. reached, or a fatal error is reached, and then it stops. With this switch,
  624. the compiler will stop after the first error.
  625. .TP
  626. .BI \-Sg
  627. Support the label and goto commands.
  628. .TP
  629. .BI \-Sh
  630. use ansistrings by default.
  631. .TP
  632. .BI \-SIxxx
  633. Specify the kind of interfaces.
  634. .I xxx
  635. can be one of the following:
  636. .RS
  637. .TP
  638. .I COM
  639. use COM interfaces. (all interfaces descend from IUnknown)
  640. .TP
  641. .I CORBA
  642. use CORBA interfaces. (no inheritance is supposed)
  643. .RE
  644. .TP
  645. .BI \-Si
  646. Support C++ style INLINE.
  647. .TP
  648. .BI \-Sm
  649. Support C-style macros.
  650. .TP
  651. .BI \-So
  652. Try to be Borland TP 7.0 compatible (no function
  653. overloading etc.).
  654. .TP
  655. .BI \-Sp
  656. Try to be
  657. .I GPC (GNU Pascal Compiler)
  658. compatible.
  659. .TP
  660. .BI \-Ss
  661. The name of constructors must be "init", and the
  662. name of destructors should be "done".
  663. .TP
  664. .BI \-St
  665. Allow the "static" keyword in objects.
  666. .TP
  667. .BI \-Un
  668. Do not check the unit name. Normally, the unit name
  669. is the same as the filename. This option allows both to be different.
  670. .TP
  671. .BI \-Ur
  672. Create a release unit. This sets a special flag in the unit, causing the
  673. compiler not to look for sources.
  674. .TP
  675. .BI \-Us
  676. Compile a system unit. This option causes the
  677. compiler to define only some very basic types.
  678. .SH SEE ALSO
  679. .BR fpc.cfg (5)
  680. .BR ppdep (1)
  681. .BR ppudump (1)
  682. .BR ppumove (1)
  683. .BR ptop (1)
  684. .BR h2pas (1)
  685. .BR ld (1)
  686. .BR as (1)