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