faq.htm 33 KB

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