faq.txt 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. 1. [1]What is Free Pascal (FPC)?
  2. 2. [2]Which versions exist, and which one should I use?
  3. 3. [3]Free Pascal and GNU Pascal - a comparison
  4. 4. [4]Where can I get the compiler ?
  5. 5. [5]What are the considerations in porting
  6. 6. [6]I tried to compile my Delphi code with the Free Pascal
  7. 7. [7]I have to write a program for homework. Can you help?
  8. 8. [8]How can I build a unit?
  9. 9. [9]Will Free Pascal support TV (Turbo Vision) in the future?
  10. 10. [10]How can I compile the system unit?
  11. 11. [11]I get an internal error 9999 or 10?
  12. 12. [12]How does function overloading work?
  13. 13. [13]How can I call C functions?
  14. 14. [14]How can I use the graph unit with Free Pascal?
  15. 15. [15]Why do I get wrong colors when using the graph unit?
  16. 16. [16]Integrated Assembler syntax
  17. 17. [17]How can I access DOS memory / How can I do graphics
  18. programming?
  19. 18. [18]How can I run Free Pascal without a math coprocessor?
  20. 19. [19]How do I reserve more than 2 megabytes of RAM?
  21. 20. [20]How can I access I/O ports?
  22. 21. [21]I'm using the Dos compiler under Windows 95
  23. 22. [22]I'm using OS/2
  24. 23. [23]INSTALL.EXE of Dos version 0.99.10 reports "Load error: no
  25. DPMI"
  26. 24. [24]INSTALL.EXE of version 1.0 for Dos returns an error (-2) in
  27. Windows NT 4.0
  28. 25. [25]INSTALL.EXE of version 1.0.6 or below returns an unknown error (-1)
  29. under OS/2
  30. or
  31. [25]INSTALL.EXE of version 1.0.6 or above complains about missing
  32. TZ variable under OS/2
  33. 26. [26]I want a new version NOW
  34. 27. [27]Where can I find a text mode IDE?
  35. 28. [28]How do I configure the Dos IDE?
  36. 29. [29]Why are the generated binaries so big?
  37. 30. [30]Unit system, syslinux, sysos2 or syswin32 not found errors
  38. 31. [31]Known bugs
  39. 32. [32]How can I find where an error occurred using the addresses a
  40. crashed program prints?
  41. 1. What is Free Pascal (FPC)?
  42. Originally named FPK-Pascal, the Free Pascal compiler is a 32 bit
  43. Turbo Pascal compatible Pascal compiler for DOS, Linux, Win32,
  44. OS/2 and (based on an older version) the AmigaOS. More operating
  45. systems (BeOS and FreeBSD/ELF are in advanced stages of
  46. development) are in the works.
  47. The compiler is written in Pascal and is able to compile its own
  48. sources. The source files are included.
  49. Free Pascal is modest regarding its minimal system requirements
  50. (386-25 Mhz for the Intel version and ideally a 68020 processor
  51. for the Motorola version). At least 2 megabytes of RAM are
  52. required. To remake the compiler more than 16MB is recommended.
  53. Short history:
  54. + 6/1993: project start
  55. + 10/1993: first little programs work
  56. + 3/1995: the compiler compiles the own sources
  57. + 3/1996: released to the internet
  58. + 7/2000: 1.0 version
  59. 2. Which versions exist, and which one should I use?
  60. FPC's version numbering changed a few times over the years.
  61. Versions before 0.99.5 are considered archaic. After the release
  62. of 0.99.5 a system in version numbering was introduced, and that
  63. system was changed slightly changed after the 1.0 release.
  64. Versioning for versions 0.99.5 - 1.0
  65. Compilers with an even last number are release versions(e.g.
  66. 0.99.8, 0.99.10, 0.99.12, 0.99.14 1.0.0)
  67. Compilers and packages with an odd last number are development
  68. versions (e.g. 0.99.9, 0.99.11, 0.99.13, 0.99.15)
  69. 0.99.5 is an exception to this rule, since 0.99.5 IS a release (a
  70. release prior to the introduction of this odd/even system).
  71. Letters behind the version number (0.99.12b, 0.99.5d) indicate
  72. release versions with some bugs and problems in the original
  73. release (respectively 0.99.12 and 0.99.5) fixed.
  74. Versioning after 1.0
  75. Together with the release of 1.0 the version numbering has been
  76. slightly changed, and a system in versioning resembling the Linux
  77. kernel's has been introduced. The main difference is that the
  78. difference between a release version is now in the second number
  79. (1.0.x vs 1.1.x) instead of the third number (0.99.14 vs 0.99.15),
  80. and the third number now becomes the patch level, replacing the
  81. postfixed letter in the old system.
  82. + Releases that only fix bugs in version 1.0 will be numbered
  83. 1.0.x
  84. + New development (the so called snapshots) have version number
  85. 1.1.x. The meaning of the third version number x in the new
  86. development branch is not defined yet, it could be used for
  87. test releases or to signal major changes.
  88. + Eventually the 1.1.x versions, when stabilized will be
  89. released as version 1.2. Fixes on the 1.2 release will be
  90. numbered 1.2.x
  91. + The new development after the 1.2 release will be numbered
  92. 1.3.x and so on
  93. + When really big changes are implemented, the version will be
  94. updated in the major number. This could be case with e.g. a
  95. codegenerator rewrite with support for other processors
  96. Normally you would want to use a release. Releases are considered
  97. stable, and easier to support (the bugs, quirks and unintended
  98. "features" are well known after a period of time, and workarounds
  99. exist).
  100. Development snapshots (which are generated daily) reflect the
  101. current status of the compiler. Development versions probably have
  102. new features and larger bugs fixed since the last release, but
  103. might have some temporary stability drawbacks (which are usually
  104. fixed by the next day).
  105. Most support for development snapshots are basically the advise to
  106. upgrade to newer snapshot in which the bugs are hopefully fixed.
  107. Since version 0.99.8 the stability of the compiler steadily
  108. increased and development snapshots are often quite useful for
  109. certain categories of users. Ask in the maillists if it is worth
  110. the trouble in your case if you're not sure.
  111. The current release version is 1.00 for the OS/2, Linux, Windows
  112. and Dos (Go32V2) targets and 0.99.5d for the 680x0 based systems
  113. (Amiga and Atari ST). The development versions (snapshots) are
  114. numbered 1.1.x at the moment
  115. We advise all users to upgrade to the newest version for their
  116. target. (1.0 for intel processors, and 0.99.5d for Motorola)
  117. 3. Free Pascal and GNU Pascal - a comparison
  118. Aim:
  119. Free Pascal tries to implement a Borland compatible
  120. pascal compiler on as many platforms as possible. GNU
  121. Pascal tries to implement a portable pascal compiler
  122. based on POSIX.
  123. Version:
  124. Currently, Free Pascal is at version 1.00 for the Intel
  125. version and version 0.99.5d for the Motorola/Intel
  126. version. Version 0.99.5d differs from version 0.99.5 in
  127. that all run time library fixes have been applied, as
  128. well as all known code generation bugs. Version 1.00
  129. differs from version 0.99.5d in that all parser bugfixes
  130. have also been applied and also a lot of Delphi 2 and
  131. Delphi 3 extensions have been implemented. GNU Pascal is
  132. at version 2.8.1 (but this numbering is not really an
  133. indication, it follows the GNU C numbering, since it is a
  134. derivation of it)
  135. Operating systems:
  136. Free pascal runs on a limited number of systems : DOS,
  137. Win32, Linux, OS/2 and AmigaOS and is for the moment
  138. limited to the Intel and Motorola architectures. GNU
  139. Pascal runs basically on any system that can run GNU C.
  140. Sources:
  141. Free Pascal is entirely written in Pascal (about 6 Mb of
  142. source code), while GNU Pascal is written in C (it's an
  143. adaptation of the GNU C compiler: 2.8 Mb code + 8 MB of
  144. GNU C code)
  145. Language:
  146. Free Pascal supports the Borland Pascal dialect Borland,
  147. and implements the Delphi Object Pascal language. GNU
  148. Pascal supports ISO 7185, ISO 10206, (most of) Borland
  149. Pascal 7.0
  150. Extensions:
  151. Free Pascal implements method, function and operator
  152. overloading. GNU Pascal implements operator overloading.
  153. License:
  154. Both compilers come under the GNU GPL.
  155. Author:
  156. Free Pascal was started by Florian Klaempfl, Germany
  157. ([email protected]), GNU Pascal was started by
  158. Jukka Virtanen, Finland ([email protected]).
  159. 4. Where can I get the compiler ?
  160. Free Pascal is available for download from all [33]official
  161. mirrors
  162. 5. What are the considerations in porting code to other processors?
  163. Because the compiler now supports processors other than the Intel,
  164. it is important to take a few precautions so that your code will
  165. execute correctly on all processors.
  166. + Limit your use of asm statements unless it is time critical
  167. code
  168. + Don't use the packed directive unless you know exactly what
  169. you are doing. Most processors require alignment of data, and
  170. using packed on objects,classes and records may break this
  171. requirement. If this is the case your code will simply crash
  172. on the target processors.
  173. + Clean up at the end of your program, i.e. close all files on
  174. exit, as some operating systems don't like it when some files
  175. are left opened.
  176. + Try not to rely on the endian of the specific machines when
  177. doing arithmetic operations. Furthermore, reading and writing
  178. of binary data to/from files will probably require byte swaps
  179. across different endian machines (swap is your friend in this
  180. case). This is even more important if you write binary data
  181. to files.
  182. + Try limiting your local variables in subroutines to 32K, as
  183. this is the limit of some processors, use dynamic allocation
  184. instead.
  185. + Try limiting the size of parameters passed to subroutines to
  186. 32K, as this is the limit of some processors, use const or
  187. var parameters instead.
  188. 6. I tried to compile my Delphi code with the Free Pascal Compiler,
  189. but it seems that it doesn't recognize Delphi style OOP.
  190. The compiler supports the Delphi OOP. Make sure you use the -S2 or
  191. -Sd switches (see the manuals for the meaning of these switches).
  192. For a list of Delphi incompabilities also check the manual.
  193. 7. I have to write a program for homework. Can you help?
  194. No. Please, don't send us mail about homework, we are no teachers.
  195. The Free Pascal development team tries to give good support for
  196. the Free Pascal compiler and are trying to always reply to emails.
  197. If we get emails like this, this becomes harder and harder.
  198. 8. How can I build a unit?
  199. It works like in Turbo Pascal. The first keyword in the file must
  200. be UNIT (not case sensitive). The compiler will generate two
  201. files: XXX.PPU and XXX.O. The PPU file contains the interface
  202. information for the compiler and the O-file the machine code (an
  203. object file, whose precise structure depends on the assembler you
  204. used). To use this unit in another unit or program, you must
  205. include its name in the USES clause of your program.
  206. 9. Will Free Pascal support TV (Turbo Vision) in the future?
  207. A Turbo Vision port, called Free Vision, has progressed nicely
  208. lately. It's already very usable, we are even writing an IDE in
  209. it. Due to copyrights problem the FreeVision source code is not
  210. available at the moment. You can download the IDE from the
  211. [34]development page. and get an idea of the look and feel though.
  212. 10. How can I compile the system unit?
  213. To recompile the system unit, it is recommended to have GNU make
  214. installed. typing 'make' in the rtl source directory will then
  215. recompile all RTL units including the system unit. You may choose
  216. to descend into the directory of your OS (e.g. rtl/go32v2) and do
  217. a 'make' there.
  218. It is possible to do all this manually, but you need more detailed
  219. knowledge of the RTL tree structure for that.
  220. 11. I get an internal error 9999 or 10?
  221. The latest versions of the Free Pascal Compiler come with an error
  222. handling routine which catches the segmentation fault and lets the
  223. compiler to exit gracefully. This is reported as an internal error
  224. 9999. Please try to reproduce the error and send [35]us a bug
  225. report.
  226. (For the curious, IE 9999 is not a specific bug. It is a safety
  227. measure which terminates if during compiling a certain condition
  228. is not met, which can be caused by several bugs. So if you report
  229. the bug, and get IE 9999 later in a different piece or part of
  230. sourcecode, it could be a completely different bug. IE 10 is
  231. something similar. It is a safety measure that is triggered when
  232. the estimated number of registers needed to evaluate an expression
  233. proves wrong. Just like IE 9999, two IE 10 problems are often
  234. independant of eachother.)
  235. 12. How does function overloading work?
  236. function overloading is implemented, like in C++:
  237. procedure a(i : integer);
  238. begin
  239. end;
  240. procedure a(s : string);
  241. begin
  242. end;
  243. begin
  244. a('asdfdasf');
  245. a(1234);
  246. end.
  247. You must be careful. If one of your overloaded functions is in the
  248. interface part of your unit, then all overloaded functions must be
  249. in the interface part. If you leave one out, the compiler will
  250. complain with a 'This overloaded function can't be local' message.
  251. Overloaded functions must differ in their parameters, it's not
  252. enough if their return types are different.
  253. 13. How can I call C functions?
  254. C calling convention is implemented as follows: The compiler
  255. pushes the parameters from right to left, but the procedure has to
  256. clear the stack. For calling the C function strcmp declare the
  257. following:
  258. function strcmp(s1 : pchar;s2 : pchar) : integer;cdecl;external;
  259. Since 0.99.5, the older [C]; won't work!
  260. 14. How can I use the graph unit with Free Pascal?
  261. Since 0.99.12, the graph unit is available both for Dos and Linux.
  262. Under Dos, it only supported VESA modes though. Since version
  263. 0.99.14, a new more system independant graph unit is included
  264. (although the only extra supported OS is Win32 and this is only
  265. rudimentary support) which also supports standard VGA.
  266. Since version 1.0, we also have a completely platform independent
  267. way of selecting resolutions and bitdepths. You are strongly
  268. encouraged to use it, because other ways will probably fail on one
  269. or other platform. See the documentation of the graph unit for
  270. more information.
  271. 15. Why do I get wrong colors when using the graph unit?
  272. If you use detect as graphdriver, you will end up with the highest
  273. supported bitdepth. Since the graph unit currently only supports
  274. up to 16 bits per pixel modes and since this bitdepth is supported
  275. by all graphics cards made in at least the last 5 years, you will
  276. most likely get a 16 bit mode.
  277. The main problem is that in 16 (and 15, 24, 32, ...) bit modes,
  278. the colors aren't set anymore using an index in a palette (the
  279. palettized way is called "indexed color"). In these modes, the
  280. color number itself determines what color you get on screen and
  281. you can't change this color. The color is encoded as follows (for
  282. most graphics cards on PC's at least):
  283. + 15 bit color: lower 5 bits are blue intensity, next come 5
  284. bits of green and then 5 bits of red. The highest bit of the
  285. word is ignored.
  286. + 16 bit color: lower 5 bits are blue intensite, next come *6*
  287. bits of green and then 5 bits of red.
  288. This means that either you have to rewrite your program so it can
  289. work with this so-called "direct color" scheme, or that you have
  290. to use D8BIT as graphdriver and DetectMode as graphmode. This will
  291. ensure that you end up with a 256 (indexed) color mode. If there
  292. are no 256 color modes supported, then graphresult will contain
  293. the value GrNotDetected after you called InitGraph and you can
  294. retry with graphdriver D4BIT. Make sure you use the constant names
  295. (D8BIT, D4BIT, ...) and not their actual numeric values, because
  296. those values can change with the next release! That the very
  297. reason why such symbolic constants exist.
  298. 16. Integrated Assembler syntax
  299. The default assembler syntax (AT&T style) is different from the
  300. one in Borland Pascal (Intel style).
  301. However, as of version 0.99.0, the compiler supports Intel style
  302. assembly syntax. See the documentation for more info on how to use
  303. different assembler styles.
  304. A description of the AT&T syntax can be found in the DJGPP FAQ
  305. [36]http://www.delorie.com/djgpp/v2faq/faq102.html#Syntax or in
  306. Brennan's Guide to Inline Assembly
  307. [37]http://www.rt66.com/%7Ebrennan/djgpp/djgpp asm.html. The
  308. documentation also contains a chapter where the difference between
  309. the Intel and AT&T style assembly is explained.
  310. Or you can use the convertor program at
  311. [38]http://rcs.urz.tu-dresden.de/schoenfu/zip/asmtrans.zip .
  312. 17. How can I access DOS memory / How can I do graphics programming?
  313. You can do like in TP, via absolute or mem[]. For larger memory
  314. blocks use the dosmemput/dosmemget routines in Go32 unit.
  315. 18. How can I run Free Pascal without a math coprocessor?
  316. On the Intel version the emulator is automatically loaded by the
  317. compiler if you add the following commands to your autoexec.bat:
  318. SET 387=N
  319. SET EMU386=C:\PP\BIN\GO32V2\WEMU387.DXE
  320. (don't forget to replace the C:\PP with the directory where you
  321. installed FPC)
  322. 19. How do I reserve more than 2 megabytes of RAM?
  323. By default Free Pascal allocates only 2MB of RAM for your
  324. application. If it just allocated all it could get, people running
  325. Windows would have problems as Windows would increase the swap
  326. file size to give the program more memory on and on, until the
  327. swap file drive would be full.
  328. You can specify the size of the heap with -Chxxxx. The default
  329. value is -Ch4000000. Try -Ch10000000, provided you got enough swap
  330. space.
  331. However, the heap size doesn't really matter anymore, since the
  332. Heap is able to grow: if you've used all the available heap space,
  333. the program will try to get more memory from the OS, so the heap
  334. is limited to the maximum amount of free memory provided by the
  335. OS.
  336. It is only handy if you know you will need at least a certain
  337. amount of memory. You can then specify this value using the -Ch
  338. parameter, so your program will allocate it at once on startup.
  339. This is slightly faster than growing the heap a number of times.
  340. 20. How can I access I/O ports?
  341. With versions before 0.99.10: if you're under DOS you can use the
  342. outport* and inport* procedures of the go32 unit.
  343. Since version 0.99.8, the Port array is supported like in TP, as
  344. long as you use the ports unit in your program (not available
  345. under Win32).
  346. I/O port access is possible under Linux, but that requires root
  347. privileges. Check the manuals for the IOPerm, ReadPort and
  348. WritePort procedures. (Unit Linux)
  349. 21. I'm using the Dos compiler under Windows 95
  350. There is a problem with the Dos compiler and Win 95 on computers
  351. with less than 16 MB. First set in the properties of the DOS box
  352. the DPMI memory size to max value. Now try to start a demo program
  353. in the DOS box, e.g. HELLO (starting takes some time). If this
  354. works you will be able to get the compiler to work by recompiling
  355. it with a smaller heap size, perhaps 2 or 4 MB (option -Chxxxx).
  356. 22. I'm using OS/2
  357. Problems have been reported that the GO32v2 compiler does not run
  358. on some OS/2 installations. You can use the native OS/2 compiler
  359. (strongly preferred solution) or maybe compile a GO32v1 compiler
  360. yourself. However, the GO32v2 version should generally work under
  361. OS/2 as well.
  362. 23. INSTALL.EXE of Dos version 0.99.10 reports "Load error: no DPMI"
  363. The file cwsdpmi.exe is missing in the main directory of the zip
  364. archive. The above message pops up if no other DPMI services are
  365. available. Such services are for example available in a Dos window
  366. of Windows. You can either extract that file from basego32.zip or
  367. download it from
  368. [39]http://www.brain.uni-freiburg.de/%7Eklaus/cwsdpmi.exe. Put it
  369. into the same directory as install.exe and run install again.
  370. 24. INSTALL.EXE of version 1.0 for Dos returns an error (-2) in
  371. Windows NT 4.0
  372. This is caused by long file names in some of the .ZIPs of the
  373. dosversion. A new installer will be generated that ignores the
  374. packages with long file names in it. Currently it is still being
  375. tested. Alternatively, one could use the installer from the Win32
  376. 1.0 version under NT. This has the additional benefit that the
  377. archives with long filenames can be selected and installed too.
  378. The exact cause of this problem is that a NT 4.0 dosbox doesn't
  379. support long file names for dos programs. Windows 95,98 and 2000
  380. don't exhibit this problem.
  381. + The current ZIPs on ftp have been updated with the new
  382. installer.
  383. + Dosw32100.zip, has now default the win32 installer, and the
  384. go32v2 installer packaged as installd.exe.
  385. + If you already downloaded one of the large Dos zips, repeated
  386. downloading is not necessary, just download a new installer:
  387. o [40]Plain dos installer. For dos without a 32-bit
  388. windows loaded or OS/2
  389. o [41]Win32 installer, for all win32 targets (win 95,98,NT
  390. en 2000) including their dosboxes
  391. + If you downloaded an OS/2 version, and experience problems,
  392. you can try to download the new dos installer
  393. 25. INSTALL.EXE of version 1.0.6 or below fails with an unknown
  394. error (-1) under OS/2
  395. or
  396. INSTALL.EXE of version 1.0.6 or above complains about missing
  397. TZ variable under OS/2
  398. You are most probably using an older version of OS/2 (like
  399. OS/2 Warp 3.0) and don't have TZ variable in your environment.
  400. The easiest solution is to add "SET TZ=..."
  401. (e.g. "SET TZ=CET-1CEST,3,-1,0,7200,10,-1,0,10800,3600" for most
  402. of western and central Europe) line to your CONFIG.SYS, and restart
  403. OS/2. The proper setting for you can be found e.g. using the TZCALC
  404. tool from [51]TIME868 package.
  405. 26. I want a new version NOW
  406. In the time between the release of new official versions, you can
  407. have a look at and test developer versions (so-called
  408. "snapshots"). Be warned though: this is work under progress, so in
  409. addition to old bugs fixed and new features added, this may also
  410. contain new bugs.
  411. Snapshots are generated automatically each night from the current
  412. source at that moment. Sometimes this may fail due to bigger
  413. changes not yet fully implemented. If your version doesn't work,
  414. try again one or two days later. You're advised not to download
  415. the GO32v1 version for Dos, since it's not supported any more.
  416. The latest snapshot can always be downloaded from the
  417. [42]development web page.
  418. To install a snapshot, extract the zip archive into the existing
  419. program directory of the last official version of Free Pascal
  420. (after making a backup of the original of course). You can also
  421. extract it into an empty directory and then move the files to the
  422. program directory, overwriting existing files. Make sure that you
  423. extract the ZIP archive such that the included directory structure
  424. remains intact. For example if you use PKUNZIP, use "pkunzip -d"
  425. instead of just "pkunzip". Note that snpashots also contain a new
  426. RTL which most likely can't be used with the previous release
  427. version, so backup your old RTL as well.
  428. 27. Where can I find a text mode IDE?
  429. The development of the IDE (integrated development environment) is
  430. not yet finished. However a working test version of the IDE is
  431. available as snapshot. It requires the latest compiler snapshot be
  432. installed on top of the current official version for your
  433. particular platform (1.00 for GO32v2 or Win32). So if you have not
  434. already done that, first install the latest official version (e.g.
  435. file dos100.zip or dos100full.zip, you find these in the
  436. [43]download section).
  437. Then get and extract the latest snapshot for your platform (e.g.
  438. snapshot.zip) into the directory containing the official version.
  439. Next, do the same with one of the IDE snapshots. For more details
  440. on where to find and how to install a snapshot, please see the
  441. previous FAQ item. For additional instructions for required IDE
  442. configuration please also read the next FAQ item.
  443. 28. How do I configure the Dos IDE?
  444. Once you have installed the IDE (see the previous FAQ item), it
  445. requires two configuration changes before it can compile. This is
  446. due to the fact that the IDE includes its own compiler; it does
  447. not use ppc386.exe and thus it also does not use the configuration
  448. in the file ppc386.cfg.
  449. Start fp.exe, select Target from the Compile menu and then check
  450. GO32v2. Next, choose Directories in the Otions menu and in the
  451. line "Unit directories" enter the path to your copy of the rtl
  452. directory, usually c:\pp\rtl\go32v2. If you have done everything
  453. correct and it still doesn't work, you may have grabbed a snapshot
  454. that has a bug; in this case try again one or two days later or
  455. ask for help on one of the [44]mailing lists.
  456. 29. Why are the generated binaries so big?
  457. There are several reasons and remedies for this:
  458. 1. If you are using 0.99.12: Due to some problems with the
  459. binary writer, 0.99.12 wasn't released with smartlinkable
  460. RTLs. Smartlinking causes only actually used procedures,
  461. functions and constants to be linked in.
  462. You can remedy this by using a development version and
  463. creating a smartlinking RTL. See the [45]make cycle faq or
  464. use a later release if available (0.99.14 and later do
  465. include a smartlinkable RTL). To turn on the generation of
  466. smartlinkable units, use the -Cx command line option when
  467. compiling your units. To turn on the linking of previously
  468. generated smarlinkable units, use the -XX (-XS in 0.99.12 and
  469. earlier) command line option when compiling a program.
  470. 2. Normally, all symbol information is included in the resulting
  471. program (for easier debugging). You can remove this by using
  472. the -Xs command line option when compiling your program (it
  473. won't do anything when compiling units)
  474. 3. You can use UPX to pack the .EXEs (just like e.g. pklite) for
  475. Dos (GO32v2) and Windows targets. Look [46]here for more
  476. info.
  477. 4. You can use LXLITE for packing EMX binaries, but you won't be
  478. able to run them under DOS (with extender) any more then. It
  479. might even not be possible to use them on lower OS/2 versions
  480. (like 2.x) depending on chosen type of compression. LXLITE
  481. can be found e.g. on [47]Hobbes, search for LXLITE.
  482. 5. Turn on optimalisations, both for supplied packages (RTL,
  483. API, FV, FCL) and for your own code, this will also decrease
  484. the code size.
  485. 30. Unit system, syslinux, sysos2 or syswin32 not found errors
  486. System (syslinux, sysos2 or syswin32, depending on platform) is
  487. Pascal's base unit which is implicitely used in all programs. This
  488. unit defines several standard procedures and structures, and must
  489. be found to be able to compile any pascal program by FPC.
  490. The location of the system.ppu and syslinux.o files are determined
  491. by the -Fu switch which can be specified commandline, but is
  492. usually in the ppc386.cfg configuration file.
  493. If the compiler can't find this unit there are three possible
  494. causes:
  495. 1. The ppc386.cfg isn't in the same path as the compiler
  496. executable (go32v2, win32 and OS/2) or can't be found as
  497. "/etc/ppc386.cfg" or ".ppc386.cfg" in your homedirectory
  498. (Linux).
  499. 2. The ppc386.cfg doesn't contain the -Fu line, or a wrong one.
  500. See the [48]make cycle faq, especially the chapters about the
  501. ppc386.cfg and the directory structure.
  502. 3. The files ARE found but the wrong version or platform.
  503. Correct ppc386.cfg to point to the right versions or
  504. reinstall the right versions (this can happen if you try to
  505. use a [49]snapshot compiler while the -Fu statemnt in the
  506. used ppc386.cfg still points to the RTL that came with the
  507. official release compiler).
  508. A handy trick can be executing "ppc386 programname -vt", this
  509. shows where the compiler is currently looking for the system
  510. unit's files. You might want to pipe this through more (Dos, OS/2,
  511. Windows) or less (Linux), since it can generate more than one
  512. screen information:
  513. Dos, OS/2, Windows:
  514. ppc386 programname -vt |more
  515. Linux:
  516. ppc386 programname -vt |less
  517. 31. Known bugs
  518. Go to the [50]bugs page
  519. 32. How can I find where an error occurred using the addresses a
  520. crashed program prints?
  521. 1. Starting with version 1.00, the easiest possibility is to
  522. recompile your program with -gl debugging option. This way
  523. unit LineInfo is automatically linked in, and the printout
  524. after a program crash then contains source line numbers in
  525. addition to addresses. To see RTL functions in the backtrace
  526. with their real name, you have to recompile the RTL with -gl
  527. too.
  528. 2. For older versions, or more comprehensive checking, compile
  529. the program with debugging information (use the -g command
  530. line option)
  531. 3. Load the program in the debugger (gdb(w) for 0.99.12b and
  532. earlier, gdbpas(w) for 0.99.14 and later) using
  533. gdb(pas)(w) --directory=<src dirs> myprog.exe
  534. Notes:
  535. o Under Linux/Unix, don't add the ".exe" after myprog
  536. o "src dirs" is a list of directories containing the
  537. source code files of myprog and the units it uses
  538. seperated by semi-colons (";"). The current directory is
  539. automatically included.
  540. 4. Once inside the debugger, you can (optionally) set the
  541. command line options that will be passed to your program
  542. using the command "set args <option1 option2 ...>"
  543. 5. To start the program, type "run" and press enter
  544. 6. After the program has crashed, the address of the instruction
  545. where the crash occurred will be shown. The debugger will try
  546. to display the source code line corresponding with this
  547. address. Note that this can be inside a procedure of the RTL,
  548. so the source may not always be available and most likely the
  549. RTL wasn't compiled with debugging information.
  550. 7. If you then type "bt" (BackTrace), the addreses in the call
  551. stack will be shown (the addresses of the procedures which
  552. were called before the program got to the current address).
  553. You can see which source code lines these present using the
  554. command
  555. info line *<address>
  556. For example:
  557. info line *0x05bd8
  558. References
  559. 1. http://www.freepascal.org/faq.htm#WhatIsFP
  560. 2. http://www.freepascal.org/faq.htm#versions
  561. 3. http://www.freepascal.org/faq.htm#FPandGNUPascal
  562. 4. http://www.freepascal.org/faq.htm#WhereToGetFP
  563. 5. http://www.freepascal.org/faq.htm#PortabilityTips
  564. 6. http://www.freepascal.org/faq.htm#OOP
  565. 7. http://www.freepascal.org/faq.htm#HOMEWORK
  566. 8. http://www.freepascal.org/faq.htm#HowcanIbuildaunit
  567. 9. http://www.freepascal.org/faq.htm#TurboVision
  568. 10. http://www.freepascal.org/faq.htm#CompileSystemUnit
  569. 11. http://www.freepascal.org/faq.htm#Internalerror9999
  570. 12. http://www.freepascal.org/faq.htm#Howdoesfunctionoverloadingwork
  571. 13. http://www.freepascal.org/faq.htm#HowToCallCFuncuntions
  572. 14. http://www.freepascal.org/faq.htm#HowToUseGraph
  573. 15. http://www.freepascal.org/faq.htm#WrongColors
  574. 16. http://www.freepascal.org/faq.htm#IntegratedAssemblerSyntax
  575. 17. http://www.freepascal.org/faq.htm#HowToAccessDosMemory
  576. 18. http://www.freepascal.org/faq.htm#FPwithoutfpu
  577. 19. http://www.freepascal.org/faq.htm#AccessingMoreThan4MB
  578. 20. http://www.freepascal.org/faq.htm#accessioports
  579. 21. http://www.freepascal.org/faq.htm#ImusingWin95
  580. 22. http://www.freepascal.org/faq.htm#ImusingOS2
  581. 23. http://www.freepascal.org/faq.htm#dpmi
  582. 24. http://www.freepascal.org/faq.htm#instal10NT
  583. 25. http://www.freepascal.org/faq.htm#instal106os2
  584. 26. http://www.freepascal.org/faq.htm#snapshot
  585. 27. http://www.freepascal.org/faq.htm#ideinst
  586. 28. http://www.freepascal.org/faq.htm#ideconfig
  587. 29. http://www.freepascal.org/faq.htm#binariesbig
  588. 30. http://www.freepascal.org/faq.htm#systemnotfound
  589. 31. http://www.freepascal.org/faq.htm#KnownBugs
  590. 32. http://www.freepascal.org/faq.htm#ErrorPos
  591. 33. http://www.freepascal.org/download.html
  592. 34. http://www.freepascal.org/develop.html#snapshot
  593. 35. http://www.freepascal.org/bugs.html
  594. 36. http://www.delorie.com/djgpp/v2faq/faq102.html#Syntax
  595. 37. http://www.rt66.com/%7Ebrennan/djgpp/djgpp%A0asm.html
  596. 38. http://rcs.urz.tu-dresden.de/schoenfu/zip/asmtrans.zip
  597. 39. http://www.brain.uni-freiburg.de/%7Eklaus/cwsdpmi.exe
  598. 40. ftp://ftp.freepascal.org/pub/fpc/dist/dos-1.00/separate/install.exe
  599. 41. ftp://ftp.freepascal.org/pub/fpc/dist/win32-1.00/separate/install.exe
  600. 42. http://www.freepascal.org/develop.html#snapshot
  601. 43. http://www.freepascal.org/download.html
  602. 44. http://www.freepascal.org/maillist.html
  603. 45. http://www.freepascal.org/makecyc.html
  604. 46. http://wildsau.idv.uni-linz.ac.at/mfx/upx.html
  605. 47. http://hobbes.nmsu.edu/
  606. 48. http://www.freepascal.org/makecyc.html
  607. 49. http://www.freepascal.org/faq.htm#snapshot
  608. 50. http://www.freepascal.org/bugs.html
  609. 51. http://hobbes.nmsu.edu/pub/os2/apps/internet/time/time868f.zip