home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 13 / FAQ202B.ZIP / FAQ202B.EXE / info / djgppfaq.info (.txt)
GNU Info File  |  1996-10-16  |  378KB  |  6,509 lines

  1. This is Info file djgppfaq.info, produced by Makeinfo version 1.67 from the
  2. input file djgppfaq.num.
  3. START-INFO-DIR-ENTRY
  4. * FAQ: (djgppfaq).           The DJGPP FAQ list.
  5. END-INFO-DIR-ENTRY
  6. This is the DJGPP Frequently-Asked Questions List.
  7. Copyright (C) 1994, 1995, 1996 Eli Zaretskii
  8. This is the second edition of the FAQ list,
  9. and is consistent with version 2.0 of DJGPP.
  10. This FAQ list may be freely distributed with the DJGPP package or any part
  11. thereof, provided this copyright notice is left intact on all copies.
  12. File: djgppfaq.info,  Node: Top,  Next: Urgent,  Prev: (dir),  Up: (dir)
  13. DJGPP FAQ List
  14. **************
  15.   In DJGPP (*note DJGPP overview: DJGPP.), a 32-bit compiler and programming
  16. environment, originally written for Unix machines, meet a 16-bit MS-DOS
  17. operating system.  Programmers who work in this environment have to master a
  18. large body of knowledge from both Unix and MS-DOS, especially if they want to
  19. use some advanced features, like interrupt handling, directly accessing
  20. peripheral devices, etc.
  21.   But because the DJGPP project is a product of a group of volunteers, there
  22. isn't always enough time (or patience, or money ;-) to produce documentation
  23. which will describe all the subtle features and pitfalls a user should know
  24. about.  The documentation of DJGPP-specific utilities and issues is therefore
  25. minimal, leaving wide space for confusion, in newcomers and veterans alike,
  26. and making the DJGPP learning curve quite a steep one.
  27.   This FAQ list is an attempt to take the sting out of that learning curve, by
  28. supplying solutions for problems which are known to puzzle DJGPP users.
  29. (Another solution would be to pay to DJ Delorie and other people who
  30. developed DJGPP to produce more documentation ;-).
  31.   This is Edition 2.02 of the FAQ, last updated 16 October 1996, for DJGPP
  32. Version 2.0.
  33.   Another place to look for DJGPP documentation is the DJGPP Knowledge Base, at
  34. this URL:
  35.      http://www.delorie.com/djgpp/doc/kb/
  36.   Brennan Underwood <brennan@mack.rt66.com> maintains a home page which is
  37. another valuable source for information about DJGPP, at this URL:
  38.      http://brennan.home.ml.org/djgpp
  39.   You can browse the HTML version of this FAQ list on line at the DJ Delorie's
  40. Web server, at this URL:
  41.      http://www.delorie.com/djgpp/v2faq/faq.html
  42.   If you browse this FAQ at DJ Delorie's server now, you can get the source
  43. distribution of the FAQ right here, at this URL:
  44.      http://www.delorie.com/djgpp/v2faq/faq202s.zip
  45. Also available from the DJ's server: FAQ in all the supported formats, at
  46. this URL:
  47.      http://www.delorie.com/djgpp/v2faq/faq202b.zip
  48.   A previous version of this FAQ was translated into French, e.g.
  49. ftp://ftp.delorie.com/pub/djgpp/v2faq/frfaq.zip, also available through the
  50. WWW, at this URL:
  51.      http://www.delorie.com/djgpp/v2faq/frfaq.zip
  52.   The following master menu lists the major topics in this FAQ list, including
  53. all the indices.
  54. * Menu:
  55. * Urgent::                If you are in a hurry.
  56. * DJGPP::                 What is DJGPP?
  57. * Requirements::          Hardware and software requirements for DJGPP.
  58. * Getting DJGPP::         Where and what to download?
  59. * Docs::                  Where the documentation is and how to read it.
  60. * Trouble::               When the compiler (or Make, or Info, or ...) crashes
  61. * Compiler performance::  How fast is the compiler?
  62. * Compiling::             Compile-time and link-time problems.
  63. * Running::               Running compiled programs.
  64. * Graphics::              Graphics under DJGPP.
  65. * Floating point::        Floating-point programs and FP emulation.
  66. * Debugging::             Debugging DJGPP programs.
  67. * Profiling::             Optimizing your programs.
  68. * Performance::           Run-time performance of DJGPP programs.
  69. * Memory::                Run-time memory issues.
  70. * Command line::          Command-line arguments handling in DJGPP.
  71. * Converting::            How to convert DOS code to DJGPP?
  72. * Low-level::             Low-level and hardware-oriented programming.
  73. * Legalese::              Legal aspects of programming with DJGPP.
  74. * Help::                  How to get more help.
  75. * v2::                    New in DJGPP Version 2.0.
  76. * Miscellany::            More...
  77. * About::                 Contributors to this FAQ.
  78. * Topic Index::           Search here by a problem description.
  79. * Program Index::         Search here by a program name.
  80. File: djgppfaq.info,  Node: Urgent,  Next: DJGPP,  Prev: Top,  Up: Top
  81. 1. If You Are In a Hurry
  82. ************************
  83. **Q*: Do you really mean I have to read this looongish FAQ list to get my
  84. answers?*
  85. **Q*: I have this problem which I absolutely MUST solve NOW!  What do I do?*
  86. *A* : No, you don't need to read *all* of the FAQ unless you want to
  87. (although this is by all means recommended).  The questions in this document
  88. are listed, as much as possible, in the order they appear when one goes
  89. through getting DJGPP, installing it and using it.  To quickly find an answer
  90. to your question, first look at the *Note Table of Contents: Top.  If that
  91. doesn't help, try the indices at the end of this manual.  You can either look
  92. up your question *Note by program name: Program Index, or *Note by topic
  93. name: Topic Index.  If you don't find anything appropriate, search this FAQ
  94. for words which are pertinent to your problem.  For those in a *real* hurry,
  95. here are some pointers to the most important topics in this FAQ list:
  96.    * How to ask experienced DJGPP users for help?
  97.      Use the DJGPP News group or mailing list.  For most questions, you will
  98.      have your answer in a day or two.  *Note the details on how to ask the
  99.      gurus: Totally lost.
  100.    * What is the best configuration of my system for DJGPP?
  101.      This depends on your hardware and software.  *Note system configuration
  102.      guidelines: Config.
  103.    * Some files I need seem to be missing.  Where do I find them?
  104.      Check out the *Note list of required and optional packages: What to
  105.      download.
  106.    * How do I subscribe to or unsubscribe from the DJGPP mailing list?
  107.      *Note subscription instructions: Subscribing.
  108.    * How can I search News group/mailing list traffic for some info?
  109.      This FAQ includes the *Note description of DJGPP archive search servers:
  110.      Deja vu, set up by Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp>
  111.      and DJ Delorie <dj@delorie.com>.
  112. File: djgppfaq.info,  Node: DJGPP,  Next: Requirements,  Prev: Urgent,  Up: Top
  113. 2. What is DJGPP?
  114. *****************
  115. **Q*: What is DJGPP?*
  116. *A* :  DJGPP is a port of GNU C/C++ compiler and development tools to 32-bit,
  117. protected-mode environment on Intel 32-bit CPUs running MS-DOS and compatible
  118. operating systems, by DJ Delorie <dj@delorie.com> and friends.  Starting from
  119. v2.0, DJGPP programs do not need a separate extender program, only a DPMI
  120. server to run; DJGPP includes a free 32-bit DPMI server which allows for a
  121. 32-bit, 4 GByte flat address space and up to 256 MBytes of virtual memory, a
  122. compiler which produces 32-bit protected-mode code, and a suite of GNU
  123. development tools ported to MS-DOS.  These provide for a development
  124. environment which specifically favors porting Unix programs, but is also
  125. suitable for writing new code.  With a few exceptions (notably, the C++ class
  126. library), DJGPP is *free* which makes it ideal for developing free and
  127. commercial software alike.
  128. DJ Delorie <dj@delorie.com> is the developer and principal maintainer of
  129. DJGPP, but anyone is welcome and encouraged to contribute.
  130. File: djgppfaq.info,  Node: Requirements,  Next: Getting DJGPP,  Prev: DJGPP,  Up: Top
  131. 3.  Hardware and Software Requirements
  132. **************************************
  133.   This chapter describes what are the hardware and software which will allow
  134. you to use DJGPP.  Minimum, "reasonable" and optimal system configurations
  135. are listed.
  136. * Menu:
  137. * Minimum::             You cannot run DJGPP unless you have this.
  138. * OS/2::                But it crashes under OS/2!
  139. * Windows/NT::          Is it compatible with Win/NT?
  140. * DOSEmu::              Can I run it on Linux?
  141. * i286::                Why not?
  142. * Windows apps::        Can I write Windows applications with DJGPP?
  143. * Optimal hardware::    Here is your dream machine description.
  144. * Reasonable hardware:: For the rest of us.
  145. * Config::              How best to configure your system software.
  146. File: djgppfaq.info,  Node: Minimum,  Next: OS/2,  Prev: Requirements,  Up: Requirements
  147. 3.1 The minimum system requirements for using DJGPP
  148. ===================================================
  149. **Q*: What are the minimum system requirements for using DJGPP?*
  150. **Q*: Will DJGPP run on my brand-new Acme i986DX7/300 PC with a SCSI-III
  151. 10-Terabyte disk drive under MulticOS/42 v7.99 operating system?*
  152. *A* :  DJGPP requires at least 386SX CPU and between 15 and 35 MB of free
  153. disk space (*note more details on this below: Disk space.), including space
  154. for the software installation and some swap space.  A minimum of 64K of
  155. system memory is enough for DJGPP to run with the CWSDPMI free DPMI host
  156. (most other DPMI hosts will require much more), but at least 2.5MB of free
  157. extended RAM is recommended for reasonably fast compilation of large source
  158. files (4MB for compiling large C++ programs); you might see painfully slow
  159. compiles for large sources if you don't have at least that much.  If your
  160. machine doesn't have a numeric co-processor, you will need to install an
  161. emulator to run floating-point code (DJGPP provides such an emulator) or link
  162. your applications with a special emulator library (also provided with DJGPP).
  163. DJGPP will run under native DOS; any other operating system is OK if it
  164. includes a DPMI server.  Environments known to run DJGPP besides native DOS:
  165. Windows 3.1 & 3.11 DOS box, OS/2 (including Warp) DOS box, Windows 95/DOS 7,
  166. Novell NWDOS 7.x (but several people have found the DPMI services of NWDOS
  167. buggy, so they should probably be turned off and CWSDPMI used instead), and
  168. Linux DOSEmu environment.
  169. File: djgppfaq.info,  Node: OS/2,  Next: Windows/NT,  Prev: Minimum,  Up: Requirements
  170. 3.2 Does it really work under OS/2?
  171. ===================================
  172. **Q*: You tell me it will work under OS/2, but I'm experiencing strange
  173. crashes after several compilations ...*
  174. **Q*: DJGPP Make crashes when I run it on OS/2!*
  175. *A* :  There was a bug in the DPMI server of the old OS/2 versions, which is
  176. triggered by spawning child processes (like GCC does when it invokes the
  177. various compiler passes).  Current versions of OS/2 don't have that bug, so
  178. DJGPP programs should run fine under OS/2.  If you can't make this happen,
  179. chances are that your setup is incorrect.  One system parameter that can
  180. cause problems with DJGPP (reportedly, Make crashes if it isn't set
  181. correctly) is `DPMI_DOS_API.'  Setting it to `ENABLED' instead of the default
  182. `AUTO' should solve the problem.  I'm also told that experimenting with the
  183. value of `DPMI_MEMORY_LIMIT' sometimes solves problems on OS/2.
  184. If the above doesn't help, please post the details of the crashes you see to
  185. the DJGPP News group (*note description of the DJGPP news group: Newsgroup.)
  186. or mailing list (*note how to post to the mailing list: Mailing list.), and
  187. somebody will help you.
  188. One thing that you should remember when you run DJGPP on OS/2 is to set the
  189. `DOS_DPMI_INTERFACE' to "Enabled" instead of "Auto" in the DOS session
  190. settings' box.
  191. File: djgppfaq.info,  Node: Windows/NT,  Next: DOSEmu,  Prev: OS/2,  Up: Requirements
  192. 3.3 Will it work under Windows/NT?
  193. ==================================
  194. **Q*: What about Windows NT?*
  195. *A* :  Current Windows NT versions support DPMI programs in the DOS box, so
  196. DJGPP programs should run fine under NT.  Therefore, beginning with DJGPP
  197. v2.0, the distribution doesn't include real-mode `gcc.exe' anymore, as it is
  198. not needed.
  199. Note that the long filename API for DOS box is not supported by current
  200. versions of Win/NT, so you cannot have long filenames there.  (There is a
  201. rumor that the new version 4.0 of WinNT will support the LFN API, but I'm
  202. told that at least the current beta versions still don't.)
  203. You might have problems with using the SVGA modes of your video card under
  204. Win/NT.  That is because NT doesn't allow direct access to the SVGA
  205. registers, without which it is impossible to recognize the type of the SVGA
  206. and employ its capabilities.  For example, a user reported that GRX functions
  207. and the `MODETEST.EXE' program thought that only a standard VGA was
  208. installed, whereas he had an S3 card.  There is nothing you can do about this
  209. feature of Win/NT; that is the price you pay for the stability and protection
  210. you get under this OS (a runaway program that accesses hardware registers can
  211. wipe out your disk or wedge the entire system cold).  However, I'm told that
  212. Win/NT 4.0 will support "DirectX" which is a method of accessing screen,
  213. audio and other peripherals directly, so it's possible to use full GRX
  214. graphics capabilities there.
  215. The Cygnus Win32 project is another port of GCC and development tools to
  216. WinNT and Win95 platforms, which specifically targets development of Windows
  217. programs.  It is available from the Cygnus archives, e.g.
  218. ftp://ftp.cygnus.com/pub/sac/win32/ or through the Web, at this URL:
  219.      http://www.cygnus.com/misc/gnu-win32/
  220. File: djgppfaq.info,  Node: DOSEmu,  Next: i286,  Prev: Windows/NT,  Up: Requirements
  221. 3.4 Can it run under Linux?
  222. ===========================
  223. **Q*: You say it works on Linux, but I cannot seem to run the compiler from
  224. within Make...*
  225. **Q*: I can run DJGPP on Linux, but Make crashes with SIGFPE on even the
  226. simplest Makefiles!*
  227. *A* :  Versions of Linux which were released before 13 March 1996 need a
  228. patch to be able to reliably run nested DJGPP programs.  That patch was
  229. posted to the DJGPP mailing list and is available from the DJGPP mail
  230. archives, at this URL:
  231.      http://www.delorie.com/djgpp/mail-archives/djgpp/1996/02/26/13:28:52
  232. If you prefer to download that patch via ftp, you can find it on the DJGPP
  233. ftp server, e.g.
  234. ftp://ftp.delorie.com/pub/djgpp/contrib/dpmi-dosemu-djgpp.mail.
  235. You might also need to edit the RAM section of the `dosemu.conf' file to make
  236. it comfortable for DJGPP.  I suggest setting `dpmi' and `xms' to 16MB and
  237. `ems' to 4MB.
  238. Some users reported that `Make', and possibly other programs which use
  239. floating point computations, crash in DOSEmu environment on systems without
  240. an FPU, even if you set the 387 and EMU387 environment variables correctly
  241. (as explained in *Note Setting up the FP emulator: Emulation, below).  The
  242. only known work-around is to not use floating point or to upgrade your
  243. machine hardware.  It is possible that newer versions of Linux might solve
  244. this problem too, so try upgrading your Linux software.
  245. If your only problem is to run GNU Make, get the latest DJGPP port of Make,
  246. since latest ports can be configured to not issue FP instructions at all.
  247. File: djgppfaq.info,  Node: i286,  Next: Windows apps,  Prev: DOSEmu,  Up: Requirements
  248. 3.5 Can I run it on a 286?
  249. ==========================
  250. **Q*: Why can't I run DJGPP on my 286?  It has protected mode also...*
  251. *A* :  True, but the protected mode isn't an issue here.  Gcc doesn't care
  252. much about memory protection, but it does care to run on a 32-bit processor,
  253. which the 286 isn't.  A 386 or better CPU really *is* required.
  254. File: djgppfaq.info,  Node: Windows apps,  Next: Optimal hardware,  Prev: i286,  Up: Requirements
  255. 3.6 MS-Windows applications and DJGPP
  256. =====================================
  257. **Q*: Can I write MS-Windows applications with DJGPP?*
  258. *A* : Currently, you can only run DJGPP programs under Windows as DOS apps
  259. (i.e. inside DOS Box).  If you need to write true Windows apps, try using the
  260. RSX extender with EMX port of GCC and RSXWDK kit for Windows.  You can get
  261. RSX by anonymous ftp, e.g.
  262. ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc/.  People who tried this
  263. report that you must download and unzip the RSXWDK2 source archive, not only
  264. the binaries (otherwise you'll get General Protection Faults when you try to
  265. run DJGPP programs).  If you cannot reach the above site (some people say
  266. that it has closed its anonymous access), try looking on an alternative site,
  267. e.g. ftp://hermes.hrz.uni-bielefeld.de/pub/systems/msdos/misc/.  Other
  268. locations to look are RSXWDK on Cica mirrors, e.g.
  269. ftp://ftp.winsite.com/pub/pc/win3/programr/rsxwdk2s.zip, or RSXWDK on any of
  270. the TeX Archive Network sites, e.g.
  271. ftp://ftp.shsu.edu/tex-archive/systems/msdos/dpmigcc/.
  272. Another problem with RSXWDK is that the Makefiles there are written for
  273. `ndmake', so they should be rewritten for GNU Make to work.  Some more
  274. hacking of Makefiles might be required due to the fact that they are set to
  275. work with EMX, and assume you unpacked everything into `/rsxwdk.'  You will
  276. also have to recompile the libraries as they were compiled with DJGPP v1.x,
  277. and hack the v2 startup file `crt0.s' along the same lines as the v1 version
  278. which comes with RSXWDK.  (`crt0.s' comes with the DJGPP source distribution,
  279. `djlsr200.zip'.)
  280. Apart from RSXWDK, you will need a `windows.h' header file.  One place to
  281. find it is with the WINE distribution, e.g.
  282. ftp://ftp.cdrom.com/pub/FreeBSD/distfiles/ (you'll have to add -DWINELIB to
  283. CFLAGS when compiling).  However, be warned that this is a complete rewrite
  284. of the original, and might produce error messages when used to compile
  285. Windows apps.  I don't know about a better solution except using `windows.h'
  286. from a commercial compiler, which might get you into legal trouble.
  287. You will also need a help compiler, e.g.
  288. ftp://ftp.aiai.ed.ac.uk/pub/packages/tex2rtf/rtfutils/hcp505.zip, or try at
  289. the Microsoft ftp site, e.g.
  290. ftp://ftp.microsoft.com/Softlib/MSFILES/HC305.EXE.  I'm told that, legally,
  291. you must already have purchased a help compiler from Microsoft to use either
  292. one of these.
  293. A resource compiler is also required.  RSXNT (below) includes one such, but I
  294. didn't yet hear any success stories using it.  Anybody?
  295. Note that, according RSXWDK's author, that package is meant for those who
  296. already have working debugged Windows applications and are simply looking to
  297. port them to 32-bit code.  Therefore, some crucial parts of a development
  298. environment (like a debugger) are missing there.  The author of RSX has
  299. recently discontinued his support of the package and switched to RSXNT
  300. project that targets Win32 (Win9x and WinNT) platforms (below).
  301. As of this writing, nobody has reported any first-hand experience of using
  302. RSXWDK with DJGPP v2.0; the above is based on user reports under v1.x.  If
  303. you try RSXWDK with v2.0, please post a summary of your experience.
  304. There is also a newer Windows development tool-chain by the author of RSXWDK
  305. called RSXNT.  This is targeted for Win32 platforms (Win95 and WinNT) and
  306. does have debugging tools included, but it needs to be registered if you want
  307. to develop commercial or shareware applications with it.  It can be found on
  308. the same sites as RSXWDK and comes with header files from Cygnus.  You can
  309. find the DJGPP-specific version of RSXNT on SimTel mirrors, e.g.
  310. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/rsxntdj1.zip.  The sources
  311. of all the RSXNT utilities can be found in `rsxnt1.zip' archive on Cica
  312. mirrors, in the `win95/programr/' directory.  Note that currently, due to
  313. limitations of DJGPP, you cannot produce DLLs or programs that will run on
  314. Win32s platforms with RSXNT.
  315. Another way to develop Windows applications is to use the Cygnus GCC/GPP
  316. port, at this URL:
  317.      http://www.cygnus.com/gnu-win32/
  318. You can also download it via anonymous ftp, e.g.
  319. ftp://ftp.cygnus.com/pub/sac/win32/.  This one's compatible with Win32 (Win95
  320. or WinNT, not Win32s), but requires you to comply with the GNU Copyleft
  321. system.  The Cygnus distribution includes development environments which run
  322. on WinNT and Linux, targeting WinNT and Win95 platforms.  Note that, as of
  323. this writing, the Cygnus port is still in early beta phase, and some nasty
  324. bugs are bound to be there.  Contact Steve Chamberlain <sac@rtl.cygnus.com>,
  325. for more details.
  326. A better (but harder) way would be to volunteer to add Windows support to
  327. DJGPP.
  328. File: djgppfaq.info,  Node: Optimal hardware,  Next: Reasonable hardware,  Prev: Windows apps,  Up: Requirements
  329. 3.7 What you *should* buy ...
  330. =============================
  331. **Q*: What is the optimal system configuration for running DJGPP?*
  332. *A* :  Here is the description of your dream machine (at least for the next 6
  333. months :-):
  334.    * Hardware:
  335.         - the fastest CPU you can find (a 200 MHz Pentium-Pro as of this
  336.           writing);
  337.         - at least 512KB second-level (off-chip) cache memory;
  338.         - 128 MByte RAM;
  339.         - motherboard built around fast 32-bit-wide bus (VLB or PCI);
  340.         - SCSI-II hard disk with bus-mastering controller;
  341.    * Software:
  342.         - DOS, device drivers and TSRs all loaded HIGH, leaving only 5K DOS
  343.           footprint in lower (under 640K) memory;
  344.         - 8 MByte RAM disk installed, `TMPDIR' environment variable points to
  345.           it (e.g., `set TMPDIR=e:', if E: is the RAM drive letter);
  346.         - 8 MByte of disk cache, set to delayed-write operation;
  347. File: djgppfaq.info,  Node: Reasonable hardware,  Next: Config,  Prev: Optimal hardware,  Up: Requirements
  348. 3.8 What most of us will *actually* buy ...
  349. ===========================================
  350. **Q*: OK, I don't have this much money.  What is the *reasonable*
  351. configuration?*
  352. *A* :  If you have the following machine, you should be able to stop worrying
  353. about memory and compilation performance:
  354.    - CPU: 486DX2-66 with 256 KB off-chip cache;
  355.    - RAM: 16 MByte;
  356.    - Disk: 12 ms IDE with VLB controller, or SCSI;
  357.    - 4 MByte RAM disk;
  358.    - 3 MByte disk cache;
  359. This will leave you with about 8 MBytes of free extended RAM.  Note that the
  360. RAM disk must be 4 MBytes to hold the output of the preprocessor for some
  361. exceedingly large source files (notably, some GCC source files).  If you
  362. don't have that much RAM to spare and still want to compile *very* large
  363. source files, either reduce the disk cache so you can give more to RAM disk,
  364. or point `TMPDIR' to your hard disk and make the disk cache larger, if you
  365. File: djgppfaq.info,  Node: Config,  Prev: Reasonable hardware,  Up: Requirements
  366. 3.9 How to configure your system for DJGPP?
  367. ===========================================
  368. **Q*: How do I configure my system to get optimal performance under DJGPP?*
  369. *A* :  That depends on the amount of RAM you have installed in your machine.
  370. Below are some guidelines to help you.
  371.   a. If you have 2 MBytes or less RAM installed:
  372.         * Don't use *any* memory manager.
  373.         * Use of `CWSDPMI' as your DPMI host is highly recommended.
  374.         * Remove any TSR and device drivers you don't absolutely need (like
  375.           `SETVER.EXE', `HIMEM.SYS' etc.) from your `CONFIG.SYS' and
  376.           `AUTOEXEC.BAT.'
  377.         * Do *not* install disk cache or RAM disk; point your `TMPDIR'
  378.           environment variable to a directory on your hard disk.  Put a
  379.           sufficiently large `BUFFERS=' statement into your `CONFIG.SYS' (I
  380.           recommend setting `BUFFERS=40,8') to make DOS file operations
  381.           faster.
  382.         * If you use `CWSDPMI' as your DPMI host, get the `CWSPARAM' program
  383.           (from the `csdpmi3p.zip' archive) and set the "Minimum application
  384.           memory desired before 640K paging" parameter to 512K or larger.
  385.           (Depending on how much memory you actually have, you might need to
  386.           further fine-tune this parameter.  This parameter defines the
  387.           lowest amount of extended memory CWSDPMI will use; if your system
  388.           doesn't have that much free extended RAM, CWSDPMI will use
  389.           conventional memory instead, where usually there should be around
  390.           600K of free RAM.)
  391.         * If you run under Windows, be sure to set the maximum amount of
  392.           extended memory on your PIF file for the DOS box to a reasonable
  393.           value.
  394.      With this configuration, GCC will run out of free physical RAM and page
  395.      when compiling almost any C program and all C++ programs.  If you are
  396.      serious about DJGPP development, you need to buy more RAM *urgently*.
  397.   b. If you have 2-4 MBytes of RAM installed:
  398.         * Don't use *any* memory manager.
  399.         * Remove any TSR and device driver you don't absolutely need (like
  400.           `SETVER.EXE', `HIMEM.SYS') from your `CONFIG.SYS' and
  401.           `AUTOEXEC.BAT.'
  402.         * Get a disk cache which works from conventional memory and configure
  403.           it to 256K size at most, or don't use a cache at all.
  404.         * Do *not* install a RAM disk; point your `TMPDIR' environment
  405.           variable to a directory on your hard disk.
  406.         * If you run under Windows, be sure to set the maximum amount of
  407.           extended memory on your PIF file for the DOS box to a reasonable
  408.           value.
  409.      With this configuration, GCC will still run out of free physical RAM and
  410.      page when compiling large C programs and most C++ programs.  Plan to buy
  411.      more RAM as soon as you can.
  412.   c. If you have 5-8 MBytes of RAM installed:
  413.         * Use a memory manager such as EMM386 or QEMM386.  Try using the
  414.           FRAME=NONE parameter of the memory manager.  This will disable
  415.           Expanded Memory (EMS) services as far as most programs are
  416.           concerned; if you must use DJGPP together with any program which
  417.           needs EMS, try to configure that program to use Extended Memory
  418.           (XMS) instead.
  419.         * Load DOS, device drivers and TSRs *HIGH*.
  420.         * Give your disk cache 1 MByte of RAM.  Enable its delayed-write (aka
  421.           write-back) feature.
  422.         * Do *not* install a RAM disk; point your `TMPDIR' environment
  423.           variable to a directory on your hard disk.
  424.         * If, after configuring your system as above, you still have more
  425.           than 2.5 MBytes of free RAM left (4 MBytes, if you plan to program
  426.           in C++ a lot), enlarge the disk cache size.
  427.         * If you run under Windows, be sure to set the maximum amount of
  428.           extended memory on your PIF file for the DOS box to a reasonable
  429.           value.
  430.   d. If you have more than 8 MBytes of RAM:
  431.         * Use a memory manager to load DOS, TSRs and device drivers *HIGH*.
  432.         * Install at least a 2-MByte-large disk cache, configured to use the
  433.           delayed- write feature.  If you have plenty of RAM, you can give
  434.           your cache as much as 8 MBytes of memory.
  435.         * If you have more than 5 MBytes left, install a RAM disk with a size
  436.           of at least 1.5 MBytes and point your `TMPDIR' environment variable
  437.           to it.  If your RAM disk is less than 4 MBytes, GCC might run out
  438.           of space there for *very* large source files (e.g., cccp.c file
  439.           from the GCC source distribution), but this shouldn't happen unless
  440.           the size of the source file you are compiling approaches 1 MByte.
  441. Some people disable the delayed-write feature for safety reasons, to avoid
  442. losing files due to system crashes.  In such cases, you can usually gain
  443. performance without sacrificing safety by enabling delayed-write together
  444. with an option that causes the cache to flush the write-behind data before
  445. the system returns to the DOS prompt.  For a `SmartDrv' disk cache, this is
  446. achieved by specifying `/N/F' switches instead of `/X'.
  447. A tutorial is available on how to set up and get started with DJGPP, at this
  448.      http://remus.rutgers.edu/~avly/djgpp.html
  449. File: djgppfaq.info,  Node: Getting DJGPP,  Next: Docs,  Prev: Requirements,  Up: Top
  450. 4. Where and What to Download?
  451. ******************************
  452.   This chapter explains where and how can you get DJGPP, and recommends which
  453. parts of the archive you should download.
  454. * Menu:
  455. * Where to find::             Pick up from your nearest SimTel mirror.
  456. * CCT::                       Or look on one of the CCT mirrors.
  457. * How to download::           Anonymous FTP, of course!
  458. * DJGPP by WWW::              For those who use Netscape/Mosaic only.
  459. * What to download::          Look here to decide what packages you need.
  460. * Disk space::                How much disk storage do you need?
  461. * DJGPP = Fatware::           Can I do with less MBytes?
  462. File: djgppfaq.info,  Node: Where to find,  Next: CCT,  Prev: Getting DJGPP,  Up: Getting DJGPP
  463. 4.1 Where can I get DJGPP?
  464. ==========================
  465. **Q*: Where can I get DJGPP?*
  466. *A* : Look on any SimTel mirror in the pub/simtelnet/gnu/djgpp/ subdirectory.
  467. Lately, there has been considerable confusion caused by the fact that the
  468. repository which was long known by the name "SimTel" is no longer called
  469. that; its new name is "CCT".  The name SimTel has moved (along with its
  470. originator and long-time manager, Keith Petersen <w8sdz@Simtel.Net>) to
  471. another distribution network which uses almost the same ftp sites, but in
  472. different subdirectories.  The name SimTel is copyrighted by this new
  473. distribution network, and so CCT will have to discontinue its use of that
  474. name.  Experience shows that SimTel (not CCT) is better managed and updates
  475. propagate there much faster, so I advise you to try using SimTel mirrors
  476. first, and fall back to CCT only if a SimTel site is unavailable to you.
  477. This section lists the SimTel mirrors; see *Note below: CCT, for the list of
  478. CCT sites.
  479. The primary SimTel site is:
  480.      ftp.simtel.net, directory /pub/simtelnet/gnu/djgpp
  481. Here is a list of hosts by countries that offer mirror sites:
  482. Australia:
  483.      ftp.bhp.com.au, directory /pub/simtelnet/gnu/djgpp
  484. Newcastle, Australia:
  485.      ftp.iniaccess.net.au, directory /pub/simtelnet/gnu/djgpp
  486. Australia:
  487.      ftp.tas.gov.au, directory /pub/simtelnet/gnu/djgpp
  488. Australia:
  489.      sunsite.anu.edu.au, directory /pub/simtelnet/gnu/djgpp
  490. Austria:
  491.      ftp.univie.ac.at, directory /mirror/simtelnet/gnu/djgpp
  492. Brussels, Belgium:
  493.      ftp.linkline.be, directory /mirror/simtelnet/gnu/djgpp
  494. Aarshot, Belgium:
  495.      ftp.tornado.be, directory /pub/simtelnet/gnu/djgpp
  496. Sao Paulo, Brazil:
  497.      ftp.unicamp.br, directory /pub/simtelnet/gnu/djgpp
  498. Brazil:
  499.      ftp.iis.com.br, directory /pub/simtelnet/gnu/djgpp
  500. Bulgaria:
  501.      ftp.eunet.bg, directory /pub/simtelnet/gnu/djgpp
  502. Ottawa, Canada:
  503.      ftp.crc.doc.ca, directory /systems/ibmpc/simtelnet/gnu/djgpp
  504. Vancouver, Canada:
  505.      ftp.direct.ca, directory /pub/simtelnet/gnu/djgpp
  506. Chile:
  507.      sunsite.dcc.uchile.cl, directory /pub/Mirror/simtelnet/gnu/djgpp
  508. Beijing, China:
  509.      ftp.pku.edu.cn, directory /pub/simtelnet/gnu/djgpp
  510. Czech Republic:
  511.      ftp.eunet.cz, directory /pub/simtelnet/gnu/djgpp
  512. Prague, Czech Republic:
  513.      pub.vse.cz, directory /pub/simtelnet/gnu/djgpp
  514. Czech Republic:
  515.      ftp.zcu.cz, directory /pub/simtelnet/gnu/djgpp
  516. Espoo, Finland:
  517.      ftp.funet.fi, directory /mirrors/ftp.simtel.net/pub/simtelnet/gnu/djgpp
  518. Neuilly, France:
  519.      ftp.grolier.fr, directory /pub/simtelnet/gnu/djgpp
  520. Paris, France:
  521.      ftp.ibp.fr, directory /pub/simtelnet/gnu/djgpp
  522. Germany:
  523.      ftp.mpi-sb.mpg.de, directory /pub/simtelnet/gnu/djgpp
  524. Bochum, Germany:
  525.      ftp.rz.ruhr-uni-bochum.de, directory /pub/simtelnet/gnu/djgpp
  526. Chemnitz, Germany:
  527.      ftp.tu-chemnitz.de, directory /pub/simtelnet/gnu/djgpp
  528. Heidelberg, Germany:
  529.      ftp.uni-heidelberg.de, directory /pub/simtelnet/gnu/djgpp
  530. Magdeburg, Germany:
  531.      ftp.uni-magdeburg.de, directory /pub/simtelnet/gnu/djgpp
  532. Paderborn, Germany:
  533.      ftp.uni-paderborn.de, directory /pub/simtelnet/gnu/djgpp
  534. Trier, Germany:
  535.      ftp.uni-trier.de, directory /pub/pc/mirrors/simtelnet/gnu/djgpp
  536. Wuerzburg, Germany:
  537.      ftp.rz.uni-wuerzburg.de, directory /pub/pc/simtelnet/gnu/djgpp
  538. Athens, Greece:
  539.      ftp.ntua.gr, directory /pub/pc/simtelnet/gnu/djgpp
  540. Hong Kong:
  541.      sunsite.ust.hk, directory /pub/simtelnet/gnu/djgpp
  542. Hong Kong:
  543.      ftp.hkstar.com, directory /pub/simtelnet/gnu/djgpp
  544. Hong Kong:
  545.      ftp.cs.cuhk.hk, directory /pub/simtelnet/gnu/djgpp
  546. Jerusalem, Israel:
  547.      ftp.huji.ac.il, directory /pub/simtelnet/gnu/djgpp
  548. Naples, Italy:
  549.      ftp.unina.it, directory /pub/simtelnet/gnu/djgpp
  550. Italy:
  551.      cis.utovrm.it, directory /simtelnet/gnu/djgpp
  552. Italy:
  553.      ftp.flashnet.it, directory /pub/simtelnet/gnu/djgpp
  554. Italy:
  555.      mcftp.mclink.it, directory /pub/simtelnet/gnu/djgpp
  556. Saitama, Japan:
  557.      ftp.saitama-u.ac.jp, directory /pub/simtelnet/gnu/djgpp
  558. Saitama, Japan:
  559.      ftp.riken.go.jp, directory /pub/simtelnet/gnu/djgpp
  560. Japan:
  561.      ftp.iij.ad.jp, directory /pub/simtelnet/gnu/djgpp
  562. Japan:
  563.      ftp.u-aizu.ac.jp, directory /pub/PC/simtelnet/gnu/djgpp
  564. Japan:
  565.      ring.aist.go.jp, directory /pub/simtelnet/gnu/djgpp
  566. Japan:
  567.      ring.asahi-net.or.jp, directory /pub/simtelnet/gnu/djgpp
  568. Latvia:
  569.      ftp.lanet.lv, directory /pub/mirror/simtelnet/gnu/djgpp
  570. Malaysia:
  571.      ftp.jaring.my, directory /pub/simtelnet/gnu/djgpp
  572. Malaysia:
  573.      ftp.mimos.my, directory /pub/simtelnet/gnu/djgpp
  574. Mexico:
  575.      ftp.gdl.iteso.mx, directory /pub/simtelnet/gnu/djgpp
  576. Netherlands:
  577.      ftp.euro.net, directory /d5/simtelnet/gnu/djgpp/
  578. Utrecht, Netherlands:
  579.      ftp.nic.surfnet.nl, directory
  580.      /mirror-archive/software/simtelnet/gnu/djgpp
  581. Wellington, New Zealand:
  582.      ftp.vuw.ac.nz, directory /pub/simtelnet/gnu/djgpp
  583. Bergen, Norway:
  584.      ftp.bitcon.no, directory /pub/simtelnet/gnu/djgpp
  585. Krakow, Poland:
  586.      ftp.cyf-kr.edu.pl, directory /pub/mirror/Simtel.Net/gnu/djgpp
  587. Poznan, Poland:
  588.      ftp.man.poznan.pl, directory /pub/simtelnet/gnu/djgpp
  589. Warsaw, Poland:
  590.      ftp.icm.edu.pl, directory /pub/simtelnet/gnu/djgpp
  591. Aveiro, Portugal:
  592.      ftp.ua.pt, directory /pub/simtelnet/gnu/djgpp
  593. Portugal:
  594.      ftp.ip.pt, directory /pub/simtelnet/gnu/djgpp
  595. Romania:
  596.      ftp.sorostm.ro, directory /pub/simtelnet/gnu/djgpp
  597. Slovakia:
  598.      ftp.uakom.sk, directory /pub/simtelnet/gnu/djgpp
  599. Slovenia:
  600.      ftp.arnes.si, directory /software/simtelnet/gnu/djgpp
  601. Johannesburg, South Africa:
  602.      ftp.is.co.za, directory /pub/simtelnet/gnu/djgpp
  603. Stellenbosch, South Africa:
  604.      ftp.sun.ac.za, directory /pub/simtelnet/gnu/djgpp
  605. Seoul, South Korea:
  606.      ftp.nuri.net, directory /pub/simtelnet/gnu/djgpp
  607. South Korea:
  608.      ftp.sogang.ac.kr, directory /pub/simtelnet/gnu/djgpp
  609. South Korea:
  610.      sunsite.snu.ac.kr, directory /pub/simtelnet/gnu/djgpp
  611. Spain:
  612.      ftp.rediris.es, directory /mirror/simtelnet/gnu/djgpp
  613. Stockholm, Sweden:
  614.      ftp.sunet.se, directory /pub/simtelnet/gnu/djgpp
  615. Zurich, Switzerland:
  616.      ftp.switch.ch, directory /mirror/simtelnet/gnu/djgpp
  617. Chung-Li, Taiwan:
  618.      ftp.ncu.edu.tw, directory /Packages/simtelnet/gnu/djgpp
  619. Taipei, Taiwan:
  620.      nctuccca.edu.tw, directory /PC/simtelnet/gnu/djgpp
  621. Nonthaburi, Thailand:
  622.      ftp.nectec.or.th, directory /pub/mirrors/simtelnet/gnu/djgpp
  623. Edinburgh, UK:
  624.      emwac.ed.ac.uk, directory /mirror/simtelnet/gnu/djgpp
  625. Lancaster, UK:
  626.      micros.hensa.ac.uk, directory /pub/simtelnet/gnu/djgpp
  627. London, UK:
  628.      sunsite.doc.ic.ac.uk, directory /packages/simtelnet/gnu/djgpp
  629. London, UK:
  630.      ftp.demon.co.uk, directory /pub/simtelnet/gnu/djgpp
  631. Concord, California, USA:
  632.      ftp.cdrom.com, directory /pub/simtelnet/gnu/djgpp
  633. California, USA:
  634.      ftp.digital.com, directory /pub/simtelnet/gnu/djgpp/
  635. Urbana, Illinois, USA:
  636.      uarchive.cso.uiuc.edu, directory /pub/systems/pc/simtelnet/gnu/djgpp
  637. Massachusets, USA
  638.      ftp.bu.edu, directory /pub/mirrors/simtelnet/gnu/djgpp/
  639. Rochester, Michigan, USA:
  640.      OAK.Oakland.Edu, directory /pub/simtelnet/gnu/djgpp
  641. New York, NY, USA:
  642.      ftp.rge.com, directory /pub/systems/simtelnet/gnu/djgpp/
  643. Oklahoma, USA:
  644.      ftp.ou.edu, directory /pub/simtelnet/gnu/djgpp/
  645. Corvallis, Oregon, USA:
  646.      ftp.orst.edu, directory /pub/simtelnet/gnu/djgpp
  647. Utah, USA:
  648.      ftp.cyber-naut.com, directory /pub/simtelnet/gnu/djgpp
  649. Virginia, USA:
  650.      mirrors.aol.com, directory /pub/simtelnet/gnu/djgpp/
  651. File: djgppfaq.info,  Node: CCT,  Next: How to download,  Prev: Where to find,  Up: Getting DJGPP
  652. 4.2 CCT sites
  653. =============
  654. **Q*: Where can I find the nearest CCT site?*
  655. *A* :  Look up the site nearest to you in the list below:
  656. Note that the copyright to the name "SimTel" is owned by Walnut Creek which
  657. sponsors the SimTel repository, so the CCT mirrors are in the process of
  658. renaming their directories to `Coast.'  Therefore, if you don't find the
  659. directories listed below, replace "SimTel" by "Coast" and try again.
  660. The primary CCT site is in Detroit, Michigan, USA:
  661.      ftp.coast.net, directory /Coast/vendors/djgpp/.
  662. Here is a list of hosts by countries that offer mirror sites:
  663. Canberra, Australia:
  664.      archie.au, directory /micros/pc/SimTel/vendors/djgpp
  665. Edmonton, AB, Canada:
  666.      ftp.agt.net, directory /pub/SimTel/vendors/djgpp
  667. Prague, Czech Republic:
  668.      pub.vse.cz, directory /pub/simtel/vendors/djgpp
  669. London, England:
  670.      src.doc.ic.ac.uk, directory /pub/packages/simtel/vendors/djgpp
  671. Liverpool, England:
  672.      ftp.mersinet.co.uk, directory /pub/ibmpc/coast/vendors/djgpp
  673. London, England:
  674.      ftp.demon.co.uk, directory /pub/mirrors/simtel/vendors/djgpp
  675. Chemnitz, Germany:
  676.      ftp.tu-chemnitz.de, directory /pub/simtel/vendors/djgpp
  677. Mainz, Germany:
  678.      ftp.uni-mainz.de, directory /pub/pc/mirrors/simtel/vendors/djgpp
  679. Tuebingen, Germany:
  680.      ftp.uni-tuebingen.de, directory /pub/simtel/vendors/djgpp
  681. Hong Kong:
  682.      ftp.cs.cuhk.hk, directory /pub/simtel/vendors/djgpp
  683. Hong Kong:
  684.      sunsite.ust.hk, directory /pub/simtel/vendors/djgpp
  685. Dublin, Ireland:
  686.      ftp.hea.ie, directory /pub/simtel/vendors/djgpp
  687. Haifa, Israel:
  688.      ftp.technion.ac.il, directory /pub/unsupported/simtel/vendors/djgpp
  689. Naples, Italy:
  690.      ftp.unina.it, directory /pub/simtel/vendors/djgpp
  691. Pisa, Italy:
  692.      cnuce-arch.cnr.it, directory /pub/msdos/simtel/vendors/djgpp
  693. Rome, Italy:
  694.      ftp.flashnet.it, directory /mirror/simtel/vendors/djgpp
  695. Rome, Italy:
  696.      cis.utovrm.it, directory /SimTel/vendors/djgpp
  697. Tokyo, Japan:
  698.      ftp.crl.go.jp, directory /pub/pc/archives/simtel/vendors/djgpp
  699. Tokyo, Japan:
  700.      ftp.web.ad.jp, directory /pub/mirrors/Coast/vendors/djgpp
  701. Tokyo, Japan:
  702.      ring.aist.go.jp, directory /pub/coast/vendors/djgpp
  703. Tokyo, Japan:
  704.      ring.asahi-net.or.jp, directory /pub/coast/vendors/djgpp
  705. Seoul, Korea:
  706.      ftp.kornet.nm.kr, directory /pub/SimTel/vendors/djgpp
  707. Seoul, Korea:
  708.      ftp.nowcom.co.kr, directory /pub/SimTel/vendors/djgpp
  709. Utrecht, Netherlands:
  710.      ftp.nic.surfnet.nl, directory
  711.      /mirror-archive/software/simtel-vendors/djgpp
  712. Poznan, Poland:
  713.      ftp.man.poznan.pl, directory /mirror/simtel/vendors/djgpp
  714. Warsaw, Poland:
  715.      ftp.icm.edu.pl, directory /pub/simtel/vendors/djgpp
  716. Moscow, Russia:
  717.      ftp.radio-msu.net, directory /mirror/Coast/vendors/djgpp
  718. Singapore:
  719.      ftp.singnet.com.sg, directory /pub/mirrors/SimTel/vendors/djgpp
  720. Slovak Republic:
  721.      ftp.uakom.sk, directory /pub/SimTel/vendors/djgpp
  722. Taipei, Taiwan:
  723.      nctuccca.edu.tw, directory /PC/simtel/vendors/djgpp
  724. Bangkok, Thailand:
  725.      ftp.bu.ac.th, directory /pub/SimTel/vendors/djgpp
  726. Sunnyvale, CA, USA:
  727.      ftp.drcdrom.com, directory /Coast/vendors/djgpp
  728. Note that DJGPP was moved to the `SimTel/vendors/' directory on most CCT
  729. mirrors about a year ago.  This is because CCT claims a compilation copyright
  730. on its collection, to prevent people from copying the CD-ROMs which are
  731. distributed by CCT.  The GNU GPL prohibits *any* restrictions, even on
  732. compilations.  So, FSF asked for GNU and GNU-related files to be moved to a
  733. separate directory to keep people from accidentally thinking that their
  734. rights were being reduced.
  735. File: djgppfaq.info,  Node: How to download,  Next: DJGPP by WWW,  Prev: CCT,  Up: Getting DJGPP
  736. 4.3 How do I download DJGPP?
  737. ============================
  738. **Q*: How do I download files from these sites?*
  739. *A* :  FTP to the nearest site, log in as `anonymous', give your full e-mail
  740. address as password, and chdir to the `djgpp' subdirectory (the exact path to
  741. it might be different on different mirrors, check out *Note the DJGPP archive
  742. path: Where to find, for your nearest mirror.)  Then issue the `binary'
  743. command and download files you need (*note the list of required files: What
  744. to download.) with the `get' command.
  745. File: djgppfaq.info,  Node: DJGPP by WWW,  Next: What to download,  Prev: How to download,  Up: Getting DJGPP
  746. 4.4 What if I don't know what `FTP' is?
  747. =======================================
  748. **Q*: What is that `FTP' thing?  I only use `Mosaic' for Internet access.*
  749. *A* :  OK, here are some URLs for your Web browser:
  750.    - The main SimTel site, at this URL:
  751.           http://www.simtel.net/simtel.net/gnu/djgpp/
  752.    - The main CCT site, at this URL:
  753.           http://www.coast.net/Coast/vendors/djgpp/
  754.    - The CCT mirror in Rochester, MI, at this URL:
  755.           http://www.acs.oakland.edu/oak/SimTel/vendors/djgpp/
  756.    - The CCT mirror in St. Louis, MO, at this URL:
  757.           http://wuarchive.wustl.edu/systems/msdos/simtel/vendors/djgpp/
  758. You can also convert any of the mirrors' addresses listed in *Note the list
  759. of SimTel mirrors: Where to find, above to a valid URL by prepending `ftp://'
  760. to it.  For example, here is the URL for FTP from the primary CCT FTP site,
  761. e.g. ftp://ftp.coast.net/Coast/vendors/djgpp/.
  762. Gopher users can access CCT files through a Gopher client,
  763. gopher://gopher.oakland.edu.
  764. For those of you who only have an e-mail connection to the Internet, CCT
  765. files may be also obtained by e-mail from various ftp-mail servers or through
  766. the BITNET/EARN file servers.  For details send a message to the CCT list
  767. server <listserv@SimTel.Coast.NET> with this command in the message body:
  768.       get simtel-mailserver.info
  769. File: djgppfaq.info,  Node: What to download,  Next: Disk space,  Prev: DJGPP by WWW,  Up: Getting DJGPP
  770. 4.5 What Files to Download?
  771. ===========================
  772. **Q*: What's the minimum set of `.zip' files I need to download?*
  773. *A* :  This depends on what you are planning to use DJGPP for.
  774.    * To only run DJGPP-compiled programs, you MUST download all of these: (1)
  775.      (*note What to download-Footnotes::)
  776.     `v2/readme.1st'
  777.           This explains how to install DJGPP and get started with using it.
  778.     `v2/faq202b.zip'
  779.           The latest edition of this FAQ list.  Use it whenever you have
  780.           problems installing and using DJGPP.
  781.     `v2misc/csdpmi3b.zip'
  782.           CWSDPMI, the DJGPP free DPMI server.  (If you can get DPMI services
  783.           in your environment, like if you run under Windows, QDPMI, or OS/2,
  784.           you don't need CWSDPMI, but I recommend downloading it nonetheless
  785.           so you can try it in case you have trouble with other DPMI servers.)
  786.     `v2misc/pmode11b.zip'
  787.           This is an alternative DPMI server, PMODE/DJ.  Its memory footprint
  788.           is smaller than CWSDPMI and it can be bundled with DJGPP programs
  789.           to make a stand-alone executable that doesn't require a DPMI server
  790.           to run.  PMODE/DJ doesn't support virtual memory and its
  791.           implementation of the DPMI spec is a bit more restricted than that
  792.           of CWSDPMI.
  793.    * For developing C programs (no C++), you MUST download all of the above,
  794.      plus the following:
  795.     `v2gnu/bnu252b.zip'
  796.           The GNU Binutils, including `as', the GNU assembler; `ld', the GNU
  797.           linker; and their docs.
  798.     `v2/djdev200.zip'
  799.           C header files, minimal development environment, DJGPP-specific
  800.           utilities and documentation.
  801.     `v2/djtst200.zip'
  802.           A set of example programs to test your installation.
  803.     `v2gnu/gcc272b.zip'
  804.           The GNU C Compiler binaries and docs (including the docs for the C++
  805.           compiler).
  806.     `v2gnu/txi360b.zip'
  807.           Info, a stand-alone program to read GNU hypertext documentation
  808.           files, and an environment to produce such files.  Without `info',
  809.           you cannot read the docs included with the GNU software tools.
  810.    * For developing C++ programs, you will need all of the above, plus the
  811.      following:
  812.     `v2gnu/gpp272b.zip'
  813.           The GNU C++ compiler binary (the docs are part of the gccNNNb.zip
  814.           package, see above).
  815.     `v2gnu/lgp271b.zip'
  816.           The C++ header files and the GNU classes libraries, and their docs.
  817.     `v2gnu/obc272b.zip'
  818.           If you want to develop Objective-C programs, you will need this
  819.           file, which includes the Objective-C compiler and header files.
  820.    * The following are some optional packages which you might want:
  821.         - Debugging:
  822.          `v2gnu/gdb412b.zip'
  823.                GDB, the GNU Debugger and its docs.  (Note that the `djdev'
  824.                distribution includes two simpler debuggers, `edebug' and
  825.                `fsdb.'  The latter presents a user interface similar to that
  826.                of Turbo Debugger.)
  827.         - Additional development tools (consider getting at least the Make
  828.           distribution):
  829.          `v2apps/rhideb.zip'
  830.                The RHIDE integrated development environment for DJGPP,
  831.                written by Robert Hoehne
  832.                <Robert.Hoehne@Mathematik.TU-Chemnitz.DE>.
  833.          `v2/djlsr200.zip'
  834.                The sources of the DJGPP C library and utilities written
  835.                specifically for DJGPP.  If you can afford the disk space (it
  836.                requires about 10MB), I recommend installing it, so you can
  837.                easily fix possible library bugs.
  838.          `v2gnu/flx252b.zip'
  839.                Flex, a Lex-like lexical analyzer generator, and its docs.
  840.          `v2gnu/bsn124b.zip'
  841.                Bison, a Yacc-like parser generator, and its docs.
  842.          `v2gnu/dif271b.zip'
  843.                GNU Diffutils (diff, cmp, diff3, sdiff), and their docs.
  844.          `v2gnu/mak373b.zip'
  845.                GNU Make program with its docs.
  846.          `v2gnu/pat21b.zip'
  847.                GNU Patch program and docs.
  848.          `v2gnu/sed118b.zip'
  849.                GNU Sed program and its docs.
  850.         - Developing text-mode and graphics GUI applications:
  851.          `v2tk/grx20.zip'
  852.                The DJGPP graphics library.
  853.          `v2tk/bcc2grx.zip'
  854.                The interface library to convert Borland graphics calls to GRX
  855.                library calls.
  856.          `v2tk/pdc22.zip'
  857.                Public-domain Curses library.
  858.      For description of additional files not mentioned here, get the file
  859.      `00_index.txt'; it contains a full list of the distribution files and a
  860.      short description of every file.
  861. File: djgppfaq.info,  Node: What to download-Footnotes,  Up: What to download
  862. (1)  The version numbers of the packages below might not be up to date.  For
  863. the latest versions, check out the DJGPP Mini-FAQ posted weekly to the
  864. comp.os.msdos.djgpp news group.
  865. File: djgppfaq.info,  Node: Disk space,  Next: DJGPP = Fatware,  Prev: What to download,  Up: Getting DJGPP
  866. 4.6 How much disk space will I need?
  867. ====================================
  868. **Q*: Wow, that's a lot of files.  How much disk storage will I need?*
  869. *A* :  The following lists the approximate disk space required for several
  870. major configurations, and additional storage required for some optional
  871. packages:
  872.      Execution-only environment..................300 KBytes
  873.      Developing C programs.......................13 MBytes
  874.      Developing C++ programs.....................17 MBytes
  875.      Developing Objective-C programs.............15 MBytes
  876.      Additional storage for DJGPP sources........10 MBytes
  877.      Additional storage for GDB..................1.1 MBytes
  878.      Additional storage for Flex.................280 KBytes
  879.      Additional storage for Bison................310 KBytes
  880.      Additional storage for Diffutils............560 KBytes
  881.      Additional storage for Make.................520 KBytes
  882.      Additional storage for Patch................120 KBytes
  883.      Additional storage for Sed..................73 KBytes
  884.      Additional storage for Graphics libraries...4 MBytes
  885. Note that the above lists only approximate numbers.  In particular, the disk
  886. cluster size can significantly change the actual disk space required by some
  887. of the distributions (those with a large number of files).  The numbers above
  888. are for disks up to 512MB which have 8KB-long clusters.
  889. In addition to the space for installing the software, you will need some free
  890. disk space for the swap file.  You should leave enough free disk space to
  891. make the total virtual memory at least 20 MBytes; that will be enough for
  892. most applications.  Invoke the `go32-v2.exe' program without arguments to see
  893. how much DPMI memory and swap space DJGPP applications can use.  Depending on
  894. your DPMI host, you might need to review its virtual memory settings in
  895. addition to leaving free disk space; `CWSDPMI' requires only that enough free
  896. disk space be available, but other DPMI hosts have special settings to
  897. specify how much virtual memory they let their clients use, as *Note
  898. explained below: How much memory.
  899. File: djgppfaq.info,  Node: DJGPP = Fatware,  Prev: Disk space,  Up: Getting DJGPP
  900. 4.7 Can I get away with less megabytes?
  901. =======================================
  902. **Q*: The above table means that I need more than 17 MBytes for C/C++
  903. development environment; that's about 7 1.44MB diskettes to hold even the
  904. compressed archive!!  Seems to me DJGPP is afflicted by the *fatware*
  905. disease...*
  906. **Q*: Pulling that many megabytes through the net from my overloaded SimTel
  907. mirror is almost impossible.  Can't you prepare a ZIP archive which only
  908. includes stuff I can't do without?*
  909. *A* : There are a number of shareware/freeware programs floating around which
  910. allow formatting DOS diskettes to almost twice their usual capacity, so you
  911. can use less floppies.  One such program is 2M, available from CCT mirrors as
  912. 2mNN.zip, e.g. ftp://ftp.coast.net/Coast/msdos/diskutil/2m30.zip.
  913. To make downloading DJGPP easier, download and compile the `BatchFTP'
  914. program.  It allows you to submit a script of FTP commands and will
  915. repeatedly try to login into the FTP site you specify until the script is
  916. successfully completed.  It is smart enough to understand the messages which
  917. the FTP server sends to you (like `login refused' etc.) and also is nice to
  918. the remote server by sleeping for some time between login attempts.
  919. `BatchFTP' is free software and can be found on many FTP sites, e.g.
  920. ftp://oak.oakland.edu/pub/unix-c/networks/batchftp.tar.Z.
  921. `BatchFTP' is a Unix program; those who access the net from their PC (not by
  922. dialing into some Unix host with a shell account), can use a nice
  923. FTP-automating utility called `AutoWinNet' (get the file autownNN.zip from
  924. your nearest CCT mirror, e.g.
  925. ftp://ftp.coast.net/Coast/win3/winsock/autown19.zip).
  926. As for the minimal DJGPP installation, volunteers are welcome to prepare such
  927. an archive and make it publicly available, in the same spirit as `EZ-GCC' did
  928. for DJGPP v1.x.
  929. File: djgppfaq.info,  Node: Docs,  Next: Trouble,  Prev: Getting DJGPP,  Up: Top
  930. 5. The DJGPP Documentation
  931. **************************
  932.   This chapter explains where to find and how to read DJGPP documentation, and
  933. how to solve occasional problems with the docs system.
  934. * Menu:
  935. * Where is the docs::          Where to find the docs and how to read them.
  936. * No Info::                    For those who can't stand Info.
  937. * Printed docs::               How to produce a printed manual.
  938. * Ready PS::                   Where to find printer-ready manuals.
  939. * Can't find docs::            For some programs it's tricky ...
  940. * Man pages::                  How to read these.
  941. * Last resort::                Look in the source, of course!
  942. File: djgppfaq.info,  Node: Where is the docs,  Next: No Info,  Prev: Docs,  Up: Docs
  943. 5.1 Where are the documentation files?
  944. ======================================
  945. **Q*: I don't see any documentation files...*
  946. *A* :  The documentation files are in the `info/' subdirectory of your main
  947. DJGPP installation directory.  You will need a program to read these docs,
  948. which are hypertext structured files.  You have several choices:
  949.   a. Use the stand-alone `Info' reader.
  950.      Get the file txi360b.zip, e.g.
  951.      ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/txi360b.zip, which
  952.      includes `INFO.EXE' and its docs.  Unzip it and run `Info.'  It will
  953.      bring up a (hopefully) self-explanatory online help system.  Confused?
  954.      Press `?' to see the list of all Info commands.  Still confused?  Press
  955.      `h' to have `Info' take you on a guided tour through its commands and
  956.      features.
  957.   b. Use the `Info' command of your favorite Emacs-like editor.
  958.      If you use Emacs, you already know about `Info.'  (What's that?  You
  959.      don't?  Type `C-h <i>' and you will get the top-level menu of all the
  960.      Info topics.)
  961. File: djgppfaq.info,  Node: No Info,  Next: Printed docs,  Prev: Where is the docs,  Up: Docs
  962. 5.2 How to read the docs without `Info?'
  963. ========================================
  964. **Q*: I'm too old/lazy/busy to learn yet another browser, and I despise
  965. uGNUsable programs like Emacs.  How in the world can I read the DJGPP docs??*
  966. *A* :  Info files are almost plain ASCII files, so you should be able to
  967. browse them with your favorite text file browser or editor.  You will lose
  968. the hypertext structure and you might have a hard time finding the next
  969. chapter (hint: look up the name of the Next node at the beginning of this
  970. node, then use the search commands of the browser, or the Grep program, to
  971. find that name), but other than that you will see all the text.
  972. Anthony Appleyard <A.APPLEYARD@fs2.mt.umist.ac.uk> has translated the Info
  973. files for GNU C/C++ Compiler (`gcc.iNN') and GNU C Preprocessor (`cpp.iNN')
  974. into ISO-8859 (aka plain ASCII), and Stephen Turnbull
  975. <turnbull@shako.sk.tsukuba.ac.jp> has made them available on his anonymous
  976. ftp and WWW server.  You can get them as `gcc.txt' and `preprocessor.txt' by
  977. anonymous ftp, e.g. ftp://turnbull.sk.tsukuba.ac.jp/pub/djgpp/doc/; or get
  978. them with your Web browser, at this URL:
  979.      http://turnbull.sk.tsukuba.ac.jp/pub/djgpp/doc/
  980. You can also produce pure ASCII files yourself, if you have their Texinfo
  981. sources.  These are usually called `*.txi' or `*.tex' and should be included
  982. with the source distribution of every package.  To produce an ASCII file
  983. `foo.txt' from the Texinfo file `foo.txi', invoke the `Makeinfo' program like
  984. this:
  985.       makeinfo --no-split --no-headers --output foo.txt foo.txi
  986. The `Makeinfo' program is part of the Texinfo distribution which is available
  987. in txi360b.zip, e.g.
  988. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/txi360b.zip.
  989. File: djgppfaq.info,  Node: Printed docs,  Next: Ready PS,  Prev: No Info,  Up: Docs
  990. 5.3 How to print the docs?
  991. ==========================
  992. **Q*: I like my docs the old way: printed on paper, stacked near my
  993. workplace.  How can I print the documentation files which come with DJGPP?*
  994. *A* :  You will need to get and install a program called TeX or its
  995. work-alike, like LaTeX or emTeX.  (They are NOT part of DJGPP.) Then run your
  996. TeX work-alike on the docs' *source* files (called `*.txi' or `*.tex') which
  997. you get with the source distribution of every package you download.  You will
  998. get a `.dvi' file which you can print; or you can run a DVI-to-PostScript
  999. converter such as `DVIPS' to produce a PostScript output.  `DVIPS' is a free
  1000. program; you can find it on SimTel mirrors, e.g.
  1001. ftp://ftp.simtel.net/pub/simtelnet/msdos/postscrp/dvips558.zip.
  1002. DJGPP comes with a program called `TEXI2PS' which can convert *.txi files to
  1003. a crude PostScript; try it if you don't care much about the appearance of the
  1004. printed docs.
  1005. If TeX won't run, check that you have the file `texinfo.tex' which defines
  1006. the TeX macros specific to Texinfo files.  If you don't, get the GNU or DJGPP
  1007. Texinfo distribution which includes that file.
  1008. If you'd like to produce printed docs of the library reference, TeX will
  1009. complain that it cannot find a file named `libc2.tex'.  This file is
  1010. generated from all the `*.txh' files in the DJGPP source distribution
  1011. (`djlsr200.zip').  In order to build this file, you need to go to `src/libc'
  1012. and type this from the DOS command prompt:
  1013.        make doc
  1014. Note that some docs files (notably, those for GCC) will produce voluminous
  1015. print-outs.  You *have* been warned!
  1016. File: djgppfaq.info,  Node: Ready PS,  Next: Can't find docs,  Prev: Printed docs,  Up: Docs
  1017. 5.4 Where can I find docs in PostScript?
  1018. ========================================
  1019. **Q*: I don't have all these fancy packages, and I don't have disk space to
  1020. install them in the first place.  Can't you guys just include with DJGPP a
  1021. set of ready-to-print PostScript files?*
  1022. *A* :  They are *very* large and would eat up too much storage (much more
  1023. than the fancy packages you don't want to install).  Most of the people read
  1024. the docs on-line and never print them anyway.  Sorry.
  1025. However, some *Good Samaritans* from all across the Net have taken time and
  1026. effort to produce the docs in PostScript format and made them available by
  1027. anonymous ftp.  The most full set of docs for the latest versions of GNU
  1028. software is available in plain ASCII, `zip' and `tar.gz' format by anonymous
  1029. ftp from phi.sinica.edu.tw, e.g. ftp://phi.sinica.edu.tw/pub/aspac/gnu/; they
  1030. are all for A4 paper.  Other places to look for PostScript versions of GNU
  1031. documentation are:
  1032. In European A4 format, e.g. ftp://liasun.epfl.ch/pub/gnu/ps-doc/.
  1033. In US letter format, e.g. ftp://primus.com/pub/gnu-ps/.
  1034. Many GNU manuals in `HTML' (hypertext) format, suitable for reading with your
  1035. Web browser, can be viewed at the DJGPP Web site, at this URL:
  1036.      http://www.delorie.com/gnu/docs/
  1037. DJGPP includes a utility called `TEXI2PS' which converts the Texinfo source
  1038. files to crude PostScript; try it.
  1039. File: djgppfaq.info,  Node: Can't find docs,  Next: Man pages,  Prev: Ready PS,  Up: Docs
  1040. 5.5 Some docs are nowhere to be found...
  1041. ========================================
  1042. **Q*: I looked in my `info/' subdirectory, but I can't find docs for some of
  1043. the utilities, like `Sed' or `Gprof.'*
  1044. *A* :  Download the source archive (`*s.zip') for that package and look
  1045. inside it, usually in the directory called `man' or `doc.'
  1046. File: djgppfaq.info,  Node: Man pages,  Next: Last resort,  Prev: Can't find docs,  Up: Docs
  1047. 5.6 What are these `foo.1' files?
  1048. =================================
  1049. **Q*: Some docs files are called `foo.1' or `bar.man' or `baz.nroff', and
  1050. they seem to be written in some weird format which is very difficult to read.
  1051. How can I convert them to readable text files?*
  1052. *A* :  That weird format is the `troff' format which is used for writing Unix
  1053. manual pages.  The Unix command `man' converts them to formatted text files
  1054. which are usually displayed with a program like `more' or `less' (and here
  1055. `less' is considered to be more than `more' :-)).  The formatted file
  1056. includes bold and underlined letters produced by over-typing using Backspace
  1057. characters.  To format these files, you can choose one of these methods:
  1058.    * Get and install a DOS port of the `groff' package, or port it yourself
  1059.      (a very difficult task).  The latest `groff' distribution can be found
  1060.      on the GNU ftp archive, e.g. ftp://ftp.gnu.ai.mit.edu/pub/gnu/ or any of
  1061.      its mirrors.  A port of (an old version of) Groff to (an old version of)
  1062.      DJGPP can be downloaded from the DJGPP ftp server, e.g.
  1063.      ftp://ftp.delorie.com/pub/djgpp/contrib/groff.zip.
  1064.    * Get and install `CAWF', a DOS program which knows about most of the
  1065.      `troff' formatting commands.  `CAWF' can be found on one of the CCT
  1066.      mirrors, e.g. ftp://ftp.coast.net/Coast/msdos/textutil/cawf404.zip.
  1067.    * Write or port a `man' clone.  Source for one such clone was posted to
  1068.      the DJGPP news group, so you can get it there, at this URL:
  1069.           http://www.delorie.com/djgpp/mail-archives/djgpp/1995/06/19/12:57:43
  1070.      You can also download this port from the DJGPP ftp server, e.g.
  1071.      ftp://ftp.delorie.com/pub/djgpp/contrib/man-pc.zip.
  1072.    * Format the file on any Unix machine, and download the results to your PC.
  1073.      Under Unix, typing `catman -p' will print the commands which are
  1074.      required to do this; you can then run those commands on your `*.1'
  1075.      `troff' source files.
  1076. No matter which of the above methods you choose, you will need some kind of
  1077. browser which understands how to show bold and underlined letters instead of
  1078. backspace-over-typed characters.  I suggest to download a DOS port of GNU
  1079. Less, e.g. ftp://ftp.coast.net/Coast/msdos/textutil/less291x.zip, which uses
  1080. colors to show bold and underlined letters.  A DJGPP port of `Less' should be
  1081. available from the usual DJGPP distribution sites.  Another possibility is to
  1082. get the latest official GNU Less distribution, e.g.
  1083. ftp://ftp.gnu.ai.mit.edu/pub/gnu/less-316.tar.gz which can be compiled out of
  1084. the box with the Microsoft C and Borland C compilers.  (Future versions of
  1085. `Less' will also compile with DJGPP.)
  1086. Another possibility for reading formatted man pages would be with an Emacs
  1087. editor, if you use one.  Emacs has a special command to read man pages.
  1088. Beginning with version 3.6, the stand-alone `Info' program can also read man
  1089. pages (it invokes a subsidiary program `man' to format them, then displays
  1090. its output; see the file `readme.dj' in the DJGPP Texinfo distribution for
  1091. more details on how to set this up).  So if you have the DJGPP Texinfo
  1092. distribution, you can read man pages with `Info' already; if not, just
  1093. download Texinfo, e.g.
  1094. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/txi360b.zip.
  1095. Note that, for GNU packages, the man pages aren't always updated on a regular
  1096. basis.  If you need more up-to-date information, see the Info files.
  1097. File: djgppfaq.info,  Node: Last resort,  Prev: Man pages,  Up: Docs
  1098. 5.7 What if the docs don't say enough?
  1099. ======================================
  1100. **Q*: OK, I've got the docs and have read them, but I still can't figure out
  1101. some details.*
  1102. *A* :  Download the sources and look there, or ask on the net--either the
  1103. DJGPP News group or an appropriate GNU News group.
  1104. File: djgppfaq.info,  Node: Trouble,  Next: Compiler performance,  Prev: Docs,  Up: Top
  1105. 6. When the Compiler (or `Make', or `Info', or ...) Crashes...
  1106. **************************************************************
  1107.   This chapter explains how to deal with certain problems which may prevent
  1108. DJGPP programs from running on your machine.  The first 8 items on the next
  1109. menu describe specific problems; if yours doesn't go away with these
  1110. techniques, read the description of *Note the general debugging procedure:
  1111. General trouble.
  1112. * Menu:
  1113. * No DPMI::                  You must have or install a DPMI server.
  1114. * Buggy DPMI::               It might crash all of your v2.x programs.
  1115. * GCC optimizations::        GCC sometimes crashes when optimizing.
  1116. * Fatal signal::             GCC says *"Fatal signal X"*.
  1117. * Unknown filetype::         GCC says *"Unknown filetype"*.
  1118. * QEMM AUTO::                Can't use this with DJGPP.
  1119. * Make hangs::               Compiler hangs, but only under Make.
  1120. * Info can't find "Top"::  Info won't display some files.
  1121. * General trouble::          Look here for any problem not covered above.
  1122. * Redirect::                 How to redirect GCC messages to a file.
  1123. * Deja vu::                  Look up your problem in the
  1124.                                *comp.os.msdos.djgpp* archives.
  1125. * Totally lost::             When nothing seems to help, ask on the net.
  1126. File: djgppfaq.info,  Node: No DPMI,  Next: Buggy DPMI,  Prev: Trouble,  Up: Trouble
  1127. 6.1 GCC says "No DPMI"
  1128. ======================
  1129. **Q*: I'm trying to run `gcc', but all I get is a message saying "Load error:
  1130. no DPMI".  What am I doing wrong?*
  1131. *A* :  You don't have a DPMI server installed, and DJGPP v2 requires it to
  1132. run.  You can either use one of the commercial DPMI servers (e.g., run `gcc'
  1133. in a DOS box under Windows) or download and install CWSDPMI
  1134. (`csdpmi3b.zip') which is a free DPMI server written for DJGPP.
  1135. File: djgppfaq.info,  Node: Buggy DPMI,  Next: GCC optimizations,  Prev: No DPMI,  Up: Trouble
  1136. 6.2 Buggy DPMI host or junk in DJGPP.ENV can crash v2.x programs
  1137. ================================================================
  1138. **Q*: When I try to run Info, it crashes immediately...*
  1139. **Q*: I cannot run v2.0 applications: they all hang or reboot my system,
  1140. while v1.x apps run OK.  Is this what v2.0 is all about--getting me out of
  1141. the DJGPP community?*
  1142. *A* :  No, believe it or not, we don't want to oust you.  Your problems might
  1143. be caused by a buggy "DPMI" (*note DOS Protected Mode Interface: DPMI Spec.)
  1144. host installed on your machine.  One DPMI host which is particularly known to
  1145. be a source of trouble is the DPMI server which comes with Novell NWDOS.
  1146. Please see if v2.0 programs run when you disable DPMI services of your usual
  1147. configuration (DJGPP will then use the CWSDPMI program supplied with DJGPP).
  1148. Another DPMI host which is known to cause problems in DJGPP is Quarterdeck's
  1149. QDPMI which comes with QEMM 7.5.  It was reported to cause `Info' and all
  1150. DJGPP debuggers to crash.  If you use QDPMI, upgrade to the version 7.53 or
  1151. later (patches for that version are available from the Quarterdeck's ftp
  1152. site), or disable QDPMI and use CWSDPMI.
  1153. Another cause of crashes in `Info' might be trailing whitespace in the
  1154. `DJGPP.ENV' file.  The telltale signs of this failure are a stack dump that
  1155. is bogus, or doesn't start with your `main' function, or a series of SIGSEGV
  1156. that won't stop.  Actually, this is a bug in the DJGPP v2.0 startup code, so
  1157. any DJGPP program can crash in this way, but since the last section of stock
  1158. `DJGPP.ENV' belongs to `Info', it is the one which suffers most from this
  1159. bug.  Make sure your `DJGPP.ENV' doesn't have a `^Z' character at the end
  1160. (some DOS editors put it if you edit the file), and doesn't end with a blank
  1161. line.  Alternatively, upgrade to DJGPP v2.01 or later, where that bug is
  1162. fixed.
  1163. File: djgppfaq.info,  Node: GCC optimizations,  Next: Fatal signal,  Prev: Buggy DPMI,  Up: Trouble
  1164. 6.3 GCC can crash during optimization
  1165. =====================================
  1166. **Q*: When I compile my program, the compiler crashes, but the problem seems
  1167. to go away if I compile without optimization.*
  1168. *A* :  For some programs, this can be caused by an insufficient stack.  Some
  1169. source files make `cc1.exe' or `cc1plus.exe' need preposterously large
  1170. amounts of stack space, but only when you turn on optimizations.  (One user
  1171. reported that an innocent-looking C source file required 700KB of stack
  1172. before `cc1.exe' was able to compile it with optimizations!) Try stubediting
  1173. the compiler to enlarge its stack, as described elsewhere in this FAQ, *Note
  1174. how to enlarge the stack: Fatal signal, before you try any other remedies in
  1175. this section.
  1176. GCC 2.6.0 was known to crash when optimizing, especially when compiling C++
  1177. programs, but it can also happen for later versions, especially if your code
  1178. has some syntactic or semantic bug.  (This is usually a genuine GCC bug, not
  1179. something special to DJGPP.)  Upgrade to the latest version of GCC.  If that
  1180. doesn't help, then narrow the offending code fragment using the `#if 0 ...
  1181. #endif' paradigm.  If this fragment includes an error, correct it and try
  1182. again; if it is syntactically and semantically correct, then rewrite it as
  1183. equivalent, but syntactically different one.
  1184. An undocumented GCC switch can sometimes help you zero in on the code
  1185. fragment that causes GCC to crash.  If you add `-Q' to the GCC command line,
  1186. it will print the name of every function it compiles.  The function that
  1187. makes it crash is probably the one whose name is the last one printed, or the
  1188. one after that.
  1189. You can also try to disable the strength-reduction optimizations of GCC by
  1190. using the `-fno-strength-reduce' switch.  GCC has a known bug in that type of
  1191. optimization which goes back as far as version 2.5.8 and is only corrected in
  1192. GCC 2.7.2.1 or later; this bug raises its ugly head on rare occasions, but is
  1193. notoriously hard to hunt down when it does.  (The stock v2.0 distribution
  1194. should by default disable this kind of optimizations on the `lib/specs' file.)
  1195. As an extreme measure, don't optimize at all, if that's the only way to make
  1196. your program work.
  1197. Another reason for this could be some problem with your system hardware or
  1198. the BIOS (like if you set an incorrect number of wait states when accessing
  1199. memory).  To check, try running the same compilation on another machine, or
  1200. review your BIOS settings.
  1201. Yet another cause for such crashes can be connected with excess memory and/or
  1202. stack usage that GCC needs when compiling certain programs.  For details
  1203. about this, see *Note CWSDPMI allocation problems: Fatal signal, in the next
  1204. section.
  1205. File: djgppfaq.info,  Node: Fatal signal,  Next: Unknown filetype,  Prev: GCC optimizations,  Up: Trouble
  1206. 6.4 What does "Fatal signal X" mean?
  1207. ====================================
  1208. **Q*: I get "fatal signal 2" when I run GCC.*
  1209. **Q*: GCC aborts with "Internal compiler error" when compiling a large C++
  1210. program.*
  1211. *A* :  When GCC reports a "signal", it really means that an error occurred
  1212. trying to run one of the compiler passes.  The "signal" number is the DOS
  1213. error code, and 2 means "file not found" (dig out your DOS reference for
  1214. other error codes).  This means GCC couldn't find some program it needs to
  1215. run to compile your source.  Check the `COMPILER_PATH' environment variable
  1216. or what the `COMPILER_PATH' line in the `DJGPP.ENV' file says, and make sure
  1217. they point to the directory where DJGPP programs reside.  Also check that the
  1218. named directory has all the required programs: `cpp.exe', `cc1.exe',
  1219. `cc1plus.exe', `cxxfilt.exe', `gasp.exe', `as.exe', `ld.exe', and (for
  1220. Objective-C) `cc1obj.exe.'  You can use the `-v' switch to GCC to see what
  1221. programs it invokes and which one of them causes the fatal error.
  1222. The "Internal compiler error" message usually means a genuine bug in GCC
  1223. (which should be reported to FSF), but it can also happen when GCC requests
  1224. additional chunk of memory, and the DPMI server fails to allocate it because
  1225. it exhausts available memory for its internal tables.  Release 1 of CWSDPMI
  1226. can fail like this if an application asks for a large number of small memory
  1227. chunks.  If you use release 1 of CWSDPMI, you can enlarge the maximum space
  1228. that CWSDPMI uses if you get a CWSDPMI heap-fix patch, e.g.
  1229. ftp://ftp.neosoft.com/pub/users/s/sandmann/csdpmi1heapfix.zip.  Beginning
  1230. with release 2, CWSDPMI defines a larger (6KB) default heap that is
  1231. configurable by CWSPARAM program to be anywhere between 3K and 40K bytes,
  1232. without recompiling CWSDPMI.  You should upgrade to the latest CWSDPMI if you
  1233. experience such problems.
  1234. You can also run `stubedit' on `cc1plus.exe' and enlarge its maximum stack
  1235. size to 512K bytes (some people report that they needed to enlarge both the
  1236. heap of CWSDPMI and the stack of the C++ compiler to make this problem go
  1237. away).  If you see such problems when compiling a C program, stubedit
  1238. `cc1.exe.'
  1239. For a program that you wrote, another work-around is to use an alternative
  1240. algorithm for `sbrk', by putting the following somewhere in your program:
  1241.        #include <crt0.h>
  1242.        int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;
  1243. Note that the unixy sbrk algorithm might cause trouble in programs that hook
  1244. hardware interrupts.
  1245. File: djgppfaq.info,  Node: Unknown filetype,  Next: QEMM AUTO,  Prev: Fatal signal,  Up: Trouble
  1246. 6.5 What does "Unknown filetype" mean?
  1247. ======================================
  1248. **Q*: I get error messages saying "Unknown filetype" from GCC.*
  1249. **Q*: Since a few days ago, whenever I try to run most of the DJGPP programs,
  1250. they print a message "C:\DJGPP\BIN\prog.exe: not COFF" and just terminate.
  1251. Help!!!*
  1252. *A* :  It might be that your `STUBIFY.EXE' is infected by a virus.  (This is
  1253. *not* a joke!  It did happen to a few of us and can happen even to you.)  As
  1254. the DOS stub prepended to the DJGPP programs is very small, most viruses
  1255. cannot attach themselves to it without overwriting the beginning of the DJGPP
  1256. COFF image, therefore triggering this error from the code in the stub that
  1257. loads the COFF image.
  1258. Another possible cause of the "Unknown filetype" message is that you mix a
  1259. v2.0 `gcc.exe' driver with `cc1plus.exe', `cc1.exe' or other programs from an
  1260. old v1.x distribution.
  1261. File: djgppfaq.info,  Node: QEMM AUTO,  Next: Make hangs,  Prev: Unknown filetype,  Up: Trouble
  1262. 6.6 You can't use `QEMM' auto/off mode with DJGPP
  1263. =================================================
  1264. **Q*: Why do I get error message from `CWSDPMI' if I keep QEMM in auto/off
  1265. mode and run DJGPP?*
  1266. *A* :  When QEMM is in auto/off mode and there isn't anything in the system
  1267. that is using any of QEMM's features, the CPU remains in real mode.
  1268. Normally, when CWSDPMI finds the CPU in real mode, it will try to use raw XMS
  1269. services to access the extended memory.  Unfortunately, when some program
  1270. requests XMS services, it will cause QEMM to turn on.  So if CWSDPMI tries to
  1271. switch into protected mode, QEMM will trap it and give a protection violation
  1272. warning.  To avoid this unfortunate event (which requires a system reboot to
  1273. fix), CWSDPMI first checks to see if enabling XMS caused the CPU to switch
  1274. into v86 mode (meaning QEMM just turned on).  If so, CWSDPMI gracefully exits
  1275. after telling you it can't work in this set-up, like this:
  1276.       "Error: Using XMS switched the CPU into V86 mode."
  1277. All you have to do to work around this is force QEMM to be ON whenever you
  1278. run DJGPP programs so that CWSDPMI will know how to work with it properly.
  1279. To do this, just turn QEMM on before running any DJGPP program, with this
  1280. command:
  1281.       c:\qemm\qemm on
  1282. (that assumes your QEMM directory is `c:\qemm').
  1283. File: djgppfaq.info,  Node: Make hangs,  Next: Info can't find "Top",  Prev: QEMM AUTO,  Up: Trouble
  1284. 6.7 Compiler hangs, but only when invoked from Make
  1285. ===================================================
  1286. **Q*: My compiles run OK from the command line, but hang when I invoke the
  1287. compiler from Make.*
  1288. *A* :  Be sure you are invoking the correct Make program.  Borland Make was
  1289. reported to cause trouble when you invoke GCC with it (because Borland's
  1290. programs are 16-bit DPMI clients, and the DPMI 0.9 spec doesn't allow mixing
  1291. them with 32-bit DPMI clients such as DJGPP programs).  It might be that
  1292. another program called `make.exe' is found earlier on your `PATH' than the
  1293. Make which came with DJGPP.
  1294. If you use Make compiled under DJGPP v1.x, you will also experience all kinds
  1295. of trouble when invoking programs compiled under DJGPP v2.0.  That's because
  1296. v1.x programs cannot spawn v2.0 programs directly (the v1.x program sees that
  1297. the child is a DJGPP program and tries to call `go32' to run it, but `go32'
  1298. cannot run v2 programs).  The result usually will be that the child either
  1299. crashes or silently exits.  If that's your problem, be sure to upgrade your
  1300. `Make' to the port distributed with v2. (Note that v2.x programs generally
  1301. know how to spawn both v1.x and v2.x programs.)  You can use `go32-v2' to work
  1302. around this limitation (*note description of go32-v2: go32-v2., below), but I
  1303. suggest doing that only if you absolutely cannot upgrade to v2's `Make.'
  1304. Some users report that v1.x programs might sometimes hang or reboot the
  1305. machine when invoked from v2.0 Make, if the Makefile calls the v1.x program
  1306. by a name longer than the 8+3 DOS filename restriction (that is usual for
  1307. Makefiles that come from Unix).  To work around, truncate the filename of
  1308. that program in the Makefile.
  1309. File: djgppfaq.info,  Node: Info can't find "Top",  Next: General trouble,  Prev: Make hangs,  Up: Trouble
  1310. 6.8 Info doesn't like some files
  1311. ================================
  1312. **Q*: When I run the Info browser, it tells me it cannot find the node "Top".*
  1313. *A* :  Check your installation of info files.  The file `DJGPP.ENV' in the
  1314. root of your DJGPP installation mentions the variable `INFOPATH' which should
  1315. point to the directory where Info looks for its files.  It must find there a
  1316. file named `dir', the file you are trying to read, and other files with
  1317. `.iNN' or `.NN' extension, where `NN' is a number.
  1318. Assuming the above checks OK, and all the necessary info files are indeed
  1319. installed in those directories (did you remember to give that `-d' switch to
  1320. `PKUNZIP?'), it might be that some of the files were edited with a DOS-based
  1321. editor, which converted the <Newline> characters to the <CR>/<LF> pairs.
  1322. Some DOS ports of Info don't like this, because this invalidates the tag
  1323. tables included with the files which Info uses to quickly find the various
  1324. nodes.
  1325. To solve the problem, upgrade to the latest versions of Info ported to DJGPP,
  1326. which don't have this problem (beginning with version 3.6).
  1327. If you cannot upgrade for some reason, run `DTOU.EXE' on the offending files;
  1328. it will strip the extra <CR> characters to make Info happy.  DTOU is in the
  1329. `bin/' subdirectory of your main DJGPP directory.
  1330. File: djgppfaq.info,  Node: General trouble,  Next: Redirect,  Prev: Info can't find "Top",  Up: Trouble
  1331. 6.9 My problem isn't mentioned above!
  1332. =====================================
  1333. **Q*: I've installed DJGPP just like explained in the `README.*' files, but
  1334. when I run gcc, my machine crashes/hangs/needs cold boot.*
  1335. **Q*: When I compile my program, gcc says "Segmentation violation" and prints
  1336. all kinds of funny numbers and registers.*
  1337. **Q*: I get errors I can't figure out when I try to compile something.*
  1338. *A* :  Add the `-v' switch to the GCC command line and run it again.  It will
  1339. print all the subprograms (compiler passes) it is running.  Then you can see
  1340. which subprogram caused the error, or where your machine crashes.  This might
  1341. give you a hint on what's wrong.
  1342. Another cause of such problems might be that your system is set up
  1343. inefficiently.  If GCC gets too few free RAM, it will run very slowly, and
  1344. you might think it crashed when in fact it isn't.  (This kind of problem
  1345. usually happens on memory-starved machines.)  Check out the *Note system
  1346. configuration advice: Config, in this FAQ list and configure your system
  1347. accordingly.
  1348. File: djgppfaq.info,  Node: Redirect,  Next: Deja vu,  Prev: General trouble,  Up: Trouble
  1349. 6.10 I can't keep up with the error messages
  1350. ============================================
  1351. **Q*: I want to read all the error messages that GCC throws at me, but there
  1352. are so many that I can't keep up.  How can I redirect them to a file?*
  1353. **Q*: When I add `-v' to the GCC command line, how can I put all the
  1354. voluminous output into a file, so I don't miss anything when reporting a
  1355. problem?*
  1356. **Q*: I have this nifty graphics program which bombs from time to time, but
  1357. the registers and traceback info are hidden by the graphics display.  How can
  1358. I see it?*
  1359. *A* :  There are several alternatives:
  1360.   a. You can use a shell smarter then `COMMAND.COM', such as `4DOS', which
  1361.      knows how to redirect standard error stream to a file.  4DOS is
  1362.      shareware and can be found on CCT mirrors, e.g.
  1363.      ftp://ftp.coast.net/Coast/msdos/4dos/.
  1364.   b. You can also run your program under any one of the programs which save
  1365.      the output of programs they spawn in a file.  I suggest using a program
  1366.      called `SCRIPT', which is similar to its Unix namesake.  It has an
  1367.      advantage of saving everything which goes to screen *and* showing it on
  1368.      the screen at the same time.  You can find SCRIPT on CCT mirrors, e.g.
  1369.      ftp://ftp.coast.net/Coast/msdos/screen/script11.zip.
  1370.   c. Or you can use the `REDIR' program which comes with DJGPP.  It also
  1371.      redirects standard output and/or standard error to a file, but you don't
  1372.      get a chance to look at the output while the program runs.
  1373. File: djgppfaq.info,  Node: Deja vu,  Next: Totally lost,  Prev: Redirect,  Up: Trouble
  1374. 6.11 How to search DJGPP archives for similar problems
  1375. ======================================================
  1376. **Q*: OK, I have all this voluminous output of `gcc -v', but I still have no
  1377. clue.*
  1378. *A* :  Your problem might be one which has already been posted and solved on
  1379. the DJGPP News group.  DJ Delorie <dj@delorie.com> has set up a searchable
  1380. News group archive on his Web server, at this URL:
  1381.      http://www.delorie.com/djgpp/mail-archives/
  1382. You can search the *entire* mailing list archives in just a few seconds.
  1383. DJ's archives are always up to date, as they receive and store all posted
  1384. messages automatically, but the index is updated every 24 hours, so the last
  1385. day might not be searchable yet.  To search the DJGPP archives at DJ's, point
  1386. your Web browser to the above URL and specify a list of keywords pertinent to
  1387. your problem.  You will get a list of messages which include those keywords;
  1388. clicking on any of the messages will get the full text of that message.
  1389. Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp> has set up another search
  1390. engine which you can use to search the entire news group archive for an
  1391. arbitrary regular expression, at this URL:
  1392.      http://turnbull.sk.tsukuba.ac.jp/cgi-bin/search
  1393. Point your Web browser to that URL and do whatever the instructions you get
  1394. tell you.  You will receive a list of lines in the archive which contain your
  1395. regexp, with a two-line surrounding context.  You can use this to decide
  1396. which parts of the archive you need to download and read.
  1397. Steve's archives can also be fast-searched, at this URL:
  1398.      http://turnbull.sk.tsukuba.ac.jp/yaseppochi-gumi.html#djgpp
  1399. using any Web browser supporting `ISINDEX' capabilities.  This is faster, but
  1400. supports only simple keyword searches, not regular expressions.
  1401. You can also download `gzip''ed copies of DJGPP correspondence split up by
  1402. months (the most recent month might not be up-to-date) from the anonymous ftp
  1403. server set up by Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp>.  They
  1404. are available at turnbull.sk.tsukuba.ac.jp, e.g.
  1405. ftp://turnbull.sk.tsukuba.ac.jp/pub/djgpp/list-archive/.  If you look for the
  1406. traffic from a specific time period, you should look for files named
  1407. `djgpp.YYMM.gz' (they are around 250K bytes each), where YY is the year and
  1408. MM is the month number.  E.g., for February 1996 traffic get the file
  1409. `djgpp.9602.gz.'  Alternatively, look for the file which holds list traffic
  1410. for the year and the month you need with your Web browser, at this URL:
  1411.      http://turnbull.sk.tsukuba.ac.jp/pub/djgpp/list-archive/
  1412. Once you have the news group archives, or a relevant portion(s) thereof,
  1413. search for your problem by using some keywords specific to your problem, like
  1414. "crash", "violation", etc.  The archive is just a text file, so any text file
  1415. viewer/editor with search capability can do it.
  1416. Note that Steve's archives have fallen behind lately to some degree, due to
  1417. him being busy with other matters; therefore, you could find that the
  1418. archives aren't entirely up to date.  Steve says that he will return to
  1419. regular maintenance of the archives later this year.
  1420. File: djgppfaq.info,  Node: Totally lost,  Prev: Deja vu,  Up: Trouble
  1421. 6.12 How to ask DJGPP gurus for help
  1422. ====================================
  1423. **Q*: I've searched the news group archives, but didn't find anything
  1424. helpful.  I am totally lost.  *Help!!!**
  1425. **Q*: I don't have time to download all these huge files, not to mention
  1426. looking through them.  Can't you DJGPP gurus help me?  *Please??**
  1427. *A* :  DJGPP is famous for its outstandingly fast and effective user support.
  1428. To get a fast and effective solution to your problem, you will have to
  1429. supply the relevant info about your system, and describe exactly how things
  1430. went wrong for you.  To gather this info, do the following:
  1431.    * At the DOS command prompt, type `set > environ.lst', then press <Enter>.
  1432.    * Invoke the `go32-v2' program (it's in your `bin/' subdirectory) and save
  1433.      its output.
  1434.    * Post to the comp.os.msdos.djgpp news group or write to the DJGPP mailing
  1435.      list <djgpp@delorie.com> and put into your message the description of
  1436.      your calamity, the contents of the file `ENVIRON.LST', the output of
  1437.      `go32-v2', the contents of your `AUTOEXEC.BAT' and `CONFIG.SYS', and
  1438.      what GCC printed during compilation with the `-v' switch (if your
  1439.      problem is that GCC won't work).
  1440.    * If your problem involves a program that crashes and prints a stack dump,
  1441.      please post that stack dump.  It's best to run `symify' on the stack
  1442.      dump, and post the output of `symify':
  1443.             symify -o dumpfile yourprog
  1444.      (*Note detailed description of symify: Crash traceback, for more details
  1445.      about `symify.')
  1446.    * Allow for 2-3 days (more on weekends) for all the reply messages to come
  1447.      in, then act according to what they recommend.
  1448. Be warned that you might get several dozen messages in reply to your request;
  1449. this is not meant to overflow your mailbox or sabotage your relationship with
  1450. your system manager, it's just the usual friendly response of fellow
  1451. DJGPP'ers to your lonely cry for help.  Some of the replies might suggest
  1452. what you already checked and reported in your original message, or even miss
  1453. the point altogether.  Be ready for this and don't flame us for trying to
  1454. help you as much as we can.
  1455. File: djgppfaq.info,  Node: Compiler performance,  Next: Compiling,  Prev: Trouble,  Up: Top
  1456. 7. Compiler and Linker Performance
  1457. **********************************
  1458.   This chapter deals with speed of compilation and linking under DJGPP, and how
  1459. they could be improved.
  1460.   If you already know whether the compiler or the linker is the slow part, go
  1461. to the appropriate section; if not, add `-v' to your GCC command line and run
  1462. it again.  With the `-v' switch, GCC will print all the programs it invokes,
  1463. and you will be able to tell which one is taking most of the time.
  1464. * Menu:
  1465. * Slow compiler::               Are your compiles slow?
  1466. * Slow linker::                 How to boost the linking speed.
  1467. File: djgppfaq.info,  Node: Slow compiler,  Next: Slow linker,  Prev: Compiler performance,  Up: Compiler performance
  1468. 7.1 Slow Compilation
  1469. ====================
  1470. **Q*: Why GCC is compiling sooo slooowww?*
  1471. *A* :  That depends on what you mean by "slow".  The following table gives
  1472. "normal" gcc compilation speed, in source lines per second, on a 486DX2-66:
  1473.                  |  Without optimization  |  With -O2
  1474.       -----------+------------------------+------------
  1475.       C++ source |        200             |   100
  1476.       -----------+------------------------+------------
  1477.       C   source |        430             |   250
  1478. (Btw, these numbers are about 20% faster than you will get on a 40MHz Sparc2
  1479. box.)  On machines faster or slower than 486DX2-66, scale these numbers
  1480. appropriately.  When comparing to this table, don't forget to count header
  1481. files your program `#include's' in the total line count.  And *don't* check
  1482. compilation speed on very short programs (like the classic `"Hello,
  1483. world!"'), because the overhead of loading the multiple passes of the
  1484. compiler will completely hide the compiler performance.
  1485. If your results are close to these (deviations of a few percent are
  1486. considered "close" here), then that's as fast as you can get with GCC.  If
  1487. they are *significantly* lower, you may indeed have a problem; read on.
  1488. First, check to see if GCC pages to disk when it compiles.  This is
  1489. manifested by a heavy disk traffic which won't go away even if you have a
  1490. large write-back disk cache installed.  To be sure, disable the virtual
  1491. memory services for your DPMI host (for `CWSDPMI', use the `CWSDPR0' as your
  1492. DPMI host, or get the `CWSPARAM' program and change the swap filename to
  1493. point to a non-existent drive), or use `PMODE/DJ' as the DPMI host, then run
  1494. the compilation again; if the compiler aborts with an error message saying
  1495. there isn't enough memory, then it *is* paging.
  1496. If paging does happen, you need to free more extended memory.  If you have a
  1497. RAM disk, make it smaller, or don't use it at all (it only makes compiles run
  1498. about 10% faster), or make your disk cache smaller (but don't discard the
  1499. disk cache altogether); if you have other programs which use extended RAM,
  1500. make them use less of it.  Failing all of the above, buy more RAM (*note the
  1501. description of reasonable configuration: Reasonable hardware.).  Also see
  1502. *Note recommendations for optimal software configuration: Config.
  1503. If GCC doesn't page, check the settings of your disk cache.  If you don't use
  1504. a cache, install one--this can slash your compilation times by as much as
  1505. 30%, more so when compiling a large number of small files.  If you already
  1506. have a cache, enable its delayed-write (aka write-back, aka staggered-write)
  1507. operation.  Some people disable the delayed-write feature for safety reasons,
  1508. to avoid losing files due to system crashes.  In such cases, you can usually
  1509. gain performance without sacrificing safety by enabling delayed-write
  1510. together with an option that causes the cache to flush the write-behind data
  1511. before the system returns to the DOS prompt.  (For `SmartDrv' disk cache,
  1512. this is achieved by specifying `/N/F' switches instead of `/X'.)  GCC usually
  1513. gains a lot when you set up your cache in such a way, because each compiler
  1514. pass (pre-processor, compiler, assembler) must write temporary files that are
  1515. used by the following passes.
  1516. If you had some of the beta releases of v2.0 installed during the
  1517. beta-testing period, be sure to upgrade your `CWSDPMI' to the latest version.
  1518. The memory allocation scheme has been changed halfway through the
  1519. beta-testing, which made old versions of `CWSDPMI' *awfully* slow when used
  1520. with programs linked against the new versions of the library.
  1521. It is also worthwhile to check the settings of your system BIOS.  In
  1522. particular, the following items should be checked against your motherboard
  1523. vendor recommendations:
  1524.      Internal and external CPU cache....set to Enable
  1525.      CPU cache scheme...................set to Write-back, if possible
  1526.      DRAM and SRAM wait states..........vendor-recommended optimal values
  1527. Incorrect or suboptimal settings of the above items can explain as much as
  1528. 30% performance degradation on 486 machines, and as much as 500% (!) if you
  1529. have a Pentium CPU.
  1530. DJ Delorie <dj@delorie.com> reports that his well-tuned 166 MHz Pentium
  1531. system with 32 MBytes of RAM and 4 MBytes of RAM disk compiles the entire GCC
  1532. source in under 10 minutes (this takes about 45 minutes on a 40MHz Sparc2).
  1533. File: djgppfaq.info,  Node: Slow linker,  Prev: Slow compiler,  Up: Compiler performance
  1534. 7.2 Slow Linking
  1535. ================
  1536. **Q*: The compiler finishes in a few seconds, but then the linker grinds away
  1537. for more than a minute, even on a very short program...*
  1538. *A* :  Try linking the trivial `"Hello, world!"' program; it should take no
  1539. more than 7-10 seconds.  If you see much slower linking on your system, then
  1540. the following advice might help you.
  1541. A few users have reported that they got much faster linking after they've
  1542. stub-edited `ld.exe' to change the transfer buffer size to 64KB.  This
  1543. speedup effect is usually seen when DJGPP is installed on a networked drive,
  1544. or on a compressed disk; when DJGPP is installed on a local disk drive,
  1545. linking speed is not affected by the size of transfer buffer.
  1546. If you use a disk cache, make sure you enable its write-back (aka
  1547. delayed-write) operation.  Some people disable the delayed-write feature for
  1548. safety reasons, to avoid losing files due to system crashes.  In such cases,
  1549. you can usually gain performance without sacrificing safety by enabling
  1550. delayed-write together with an option that causes the cache to flush the
  1551. write-behind data before the system returns to the DOS prompt.  For
  1552. `SmartDrv' disk cache, this is achieved by specifying `/N/F' switches instead
  1553. of `/X'.
  1554. For very large (several MBytes) executables which are built from a large
  1555. number of small source files, the link stage might be the one which needs
  1556. more RAM than you have free, and thus be the bottleneck of the time it takes
  1557. to build your program.  Check that the size of the executable isn't larger
  1558. than the amount of your free RAM.  If it is, then it might make sense to use
  1559. a smaller (or even no) disk cache, and allow the linker as much physical RAM
  1560. as it needs.  Be sure that the linker wasn't stub-edited to make its transfer
  1561. buffer too small.
  1562. Another reason for slow linking might be that the `DJGPP.ENV' file by default
  1563. sets `TMPDIR' to a `tmp/' subdirectory of the main DJGPP installation
  1564. directory; if DJGPP is installed on a networked drive, this means all your
  1565. temporary files go back and forth through the network (and networked disks
  1566. are usually not cached on your PC).  In such cases, setting `TMPDIR' to a
  1567. directory on your local drive, or to a RAM disk, would probably make linking
  1568. faster.
  1569. File: djgppfaq.info,  Node: Compiling,  Next: Running,  Prev: Compiler performance,  Up: Top
  1570. 8. Compile-time and Link-time Problems
  1571. **************************************
  1572.   Being of a Unix origin, GCC has a somewhat different flavor of command-line
  1573. syntax and its peculiar compilation and link algorithms.  It also has a
  1574. plethora of optional switches, some of them obscure or semi-documented.
  1575. These are known to confuse users, especially those who had previous
  1576. experience with DOS-based C compilers.
  1577.   This chapter explains how to solve some of those problems which tend to
  1578. appear when compiling and linking your programs.
  1579. * Menu:
  1580. * Missing headers/libraries::  GCC can't find header files/libraries.
  1581. * Missing C++ headers::        GCC can't find C++ header files.
  1582. * C++ comments::               Avoid C++ comments in C programs.
  1583. * Which language::             GCC resolves it by looking at filename
  1584.                                  extensions.
  1585. * Objective C::                Can't use ObjC 2.6.0.
  1586. * DJGPP-specific::             How to write DJGPP-specific fragments.
  1587. * Unresolved externals::       Where are those library functions?
  1588. * Which library::              Which library has which functions?
  1589. * Libraries' order::           Which libraries to put first?
  1590. * Still unresolved::           C++ misses complex and iostream functions.
  1591. * Class Complex::              It is now a complex template class.
  1592. * Pure virtual::           Problems with pure virtual functions in C++.
  1593. * djgpp_first_ctor::           Why are these unresolved?
  1594. * Large image::                Static arrays bloat C++ program image.
  1595. * Large executable::           Why is DJGPP .EXE so large?
  1596. * Win95 LNK files::            These can cause DJGPP Linker to fail.
  1597. * No EXE::                     Novell Netware fails STUBIFY.
  1598. * Large object files::         Linker fails for large objects/libraries.
  1599. File: djgppfaq.info,  Node: Missing headers/libraries,  Next: Missing C++ headers,  Prev: Compiling,  Up: Compiling
  1600. 8.1 GCC can't find headers or libraries
  1601. =======================================
  1602. **Q*: When I run the compiler it says it couldn't find header files and/or
  1603. libraries.  But the headers and libraries are all there, so why won't it find
  1604. them?*
  1605. **Q*: When I link my programs, ld.exe complains that it cannot open crt0.o,
  1606. although that file exists in the lib subdirectory...*
  1607. *A* :  In order for the compiler to find its include files, libraries and
  1608. other stuff it can't do without, you should have the following variable set
  1609. in your environment:
  1610.       set DJGPP=c:/djgpp/djgpp.env
  1611. and it should point to the correct path of the file `DJGPP.ENV' on your
  1612. system (the file itself comes with the file djdev200.zip, e.g.
  1613. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djdev200.zip in the DJGPP
  1614. distribution).  In the above example it is assumed to be in the `C:/DJGPP'
  1615. directory, but you should set it as appropriate for your installation.
  1616. Sometimes, people make errors in their `AUTOEXEC.BAT' that cause the DJGPP
  1617. variable to be defined incorrectly, or not defined at all (some of the more
  1618. common causes are listed below).  To check what is the actual setting, type
  1619. from the DOS prompt:
  1620.       set > env.lst
  1621. then examine the contents of the file `env.lst'.  You should see there a line
  1622. like this:
  1623.       DJGPP=c:/djgpp/djgpp.env
  1624. If a line such as this isn't there, you should investigate the cause for this
  1625. (see below for some of the possibilities).
  1626. Many problems with setting DJGPP happen when people put excess blanks around
  1627. the `=' character, which has the effect of defining "DJGPP " (with the blank)
  1628. which is not the same as "DJGPP" (without blanks).  You should make sure
  1629. there are no such excess blanks, or DJGPP won't find its files.
  1630. Another possible cause of DJGPP variable not being set is that you invoke
  1631. another batch file from your `AUTOEXEC.BAT' before the line that sets DJGPP.
  1632. Make sure such batch files are invoked with the `CALL' statement, because
  1633. otherwise the batch file will never return (that's a "feature" of DOS batch
  1634. file processing).
  1635. The code that processes `DJGPP.ENV' assumes that this file resides in the
  1636. main DJGPP installation directory.  If that assumption is wrong, the compiler
  1637. (and some other DJGPP programs) might fail to find some of the files or
  1638. auxiliary programs they need.  *Do NOT move DJGPP.ENV to any other directory!*
  1639. Note that if you run DJGPP under Win95, WinNT or any other environment that
  1640. supports long filenames (e.g., if DJGPP is installed on a networked drive
  1641. whose network redirector supports long filenames), you *cannot* use long
  1642. names of the directories in the pathname of `DJGPP.ENV' when you set the
  1643. above variable in the environment; you should use their 8+3 names instead.
  1644. First, some of these systems (such as WinNT) do not even support the LFN API
  1645. for DOS programs.  But even if LFN API *is* supported, e.g. on Win95, DJGPP
  1646. won't know that it should support LFN until *after* it read `DJGPP.ENV'--it's
  1647. a chicken-and-egg problem.  For example, the following setting *won't work*:
  1648.       set DJGPP=c:/programs/Development/Djgpp/djgpp.env
  1649. If the DJGPP variable is set correctly, then check the following possible
  1650. causes of this misbehavior:
  1651.    * You have edited the file `DJGPP.ENV' in a way that invalidated some of
  1652.      the settings there; try restoring the original file from the
  1653.      distribution to see if that fixes your problems.  Be sure you are
  1654.      familiar with the syntax of `DJGPP.ENV' before you edit it.  The DJGPP
  1655.      server has a page with a description of the DJGPP.ENV syntax, at this
  1656.      URL:
  1657.           http://www.delorie.com/djgpp/doc/kb/kb_7.html#SEC7
  1658.    * Some older versions of Novell Netware cause the linker to fail if the
  1659.      libraries or the startup file `crt0.o' reside on a networked drive.
  1660.      This is due to a peculiarity of Novell that happens to fail the library
  1661.      function `stat' in some cases.  The exact reason of the failure has been
  1662.      identified, and the next release of the library will include a version
  1663.      of `stat' that works around that problem, so future releases of the
  1664.      linker will be free of this bug.  As a temporary work-around, move all
  1665.      the libraries and `crt0.o' to a local drive.  (1) (*note Missing
  1666.      headers/libraries-Footnotes::)  Another solution would be to upgrade your
  1667.      Novell software; version 4.x is reportedly free of this problem.
  1668.    * You renamed the `gcc.exe' driver to some other name.  In this case, you
  1669.      should edit the file `DJGPP.ENV' to add a section named after the new
  1670.      name of GCC, which is an exact duplicate of the section called `[gcc].'
  1671.      DJGPP start-up code uses this file to find environment variables which
  1672.      it should put into the environment before your `main' function is
  1673.      called, but it searches for the relevant variables using the actual name
  1674.      of the program, so when you rename the executable, it can't find its
  1675.      section and doesn't put the necessary variables into the environment.
  1676.    * Your `FILES=' setting in `CONFIG.SYS' is insufficient, so GCC runs out
  1677.      of available handles.
  1678.      You should have at least `FILE=15' in your `CONFIG.SYS.'
  1679.    * Your DJGPP directory is on a networked drive, and the network redirector
  1680.      doesn't have enough available handles in its configuration.
  1681.      Presumably, there should be a parameter in some configuration file or a
  1682.      command-line argument to one of the network drivers which sets the number
  1683.      of files that can be open simultaneously on a networked drive; you should
  1684.      set it to be at least 15.
  1685.    * You passed the `-B' switch to GCC.  This overrides the default location
  1686.      of `crt0.o' and if you follow `-B' with a directory other than that
  1687.      where `crt0.o' resides, the linker won't find it.
  1688.      You should not need to use the `-B' or `-L' switches at all if your
  1689.      installation is correct and the `DJGPP' variable points to the main
  1690.      installation directory, because GCC should be able to figure out all the
  1691.      linker switches itself.  If linking fails without explicit `-L' or `-B',
  1692.      check out above for the possible causes.
  1693. File: djgppfaq.info,  Node: Missing headers/libraries-Footnotes,  Up: Missing headers/libraries
  1694. (1)  Don't forget to add that directory to the `LIBRARY_PATH' line on
  1695. `DJGPP.ENV.'
  1696. File: djgppfaq.info,  Node: Missing C++ headers,  Next: C++ comments,  Prev: Missing headers/libraries,  Up: Compiling
  1697. 8.2 GCC can't find C++ headers
  1698. ==============================
  1699. **Q*: I installed all the packages, but GCC complains it can't find
  1700. `iostream.h', `_string.h' and other C++ headers.  Where can I find those
  1701. header files?*
  1702. **Q*: GCC complains about being unable to find `Complex.h', `Regex.h' and
  1703. other header files which start with a capital letter, and I indeed don't see
  1704. them in my `lang/cxx/' directory.  Where are they?*
  1705. **Q*: My C++ program needs header files whose filenames exceed the 8+3 DOS
  1706. filename restrictions, like `stdiostream.h' and `streambuf.h', and GCC cannot
  1707. find those files.  How in the world can I write portable C++ programs??*
  1708. *A* :  C++ include files are in the file lgp271b.zip, e.g.
  1709. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/lgp271b.zip.  Files whose
  1710. names usually start with a capital letter, on MS-DOS have an underscore `_'
  1711. prepended so they can be distinguished from `complex.h', `regex.h' and the
  1712. like under case-insensitive DOS.  Change `Complex.h' to `_complex.h' in your
  1713. source, and GCC will find them.
  1714. One possible cause for problems with C++ include files is that your source
  1715. file has a `.c' extension.  GCC then thinks that this is a C program and
  1716. doesn't search the C++ include directories.  Rename your file to `.cc' or
  1717. `.cpp' extension, or call GCC with the `-x c++' switch, and the header files
  1718. will be found.  A full list of extension rules which GCC uses to determine
  1719. the source language can be found in the *Note list of language-specific
  1720. suffixes: Which language, elsewhere in this FAQ.
  1721. If you have problems with header files with long filenames, and you run under
  1722. Win95 or some other environment which allows for long filenames, try
  1723. disabling the "Long File Names" (LFN) support in DJGPP, by setting the `LFN'
  1724. environment variable to `No', like this:
  1725.        set LFN=n
  1726. (DJGPP comes with LFN disabled by default on the `DJGPP.ENV' file, but you
  1727. might have enabled it.)  If this makes the problems go away, then you have
  1728. some conflict between the way LFN is supported by DJGPP and your environment.
  1729. Under Win95, you must rename the files which should have long filenames to
  1730. those long names (as opposed to the truncated names you find in the DJGPP
  1731. archives).  You must also set the option in the Win95 registry which disables
  1732. name-munging of the files which have exactly 8 characters in their name part.
  1733. This is how:
  1734.    * From the "Start" menu select "Run" and type `regedit', to start the
  1735.      Registry Editor.
  1736.    * Expand the `HKEY_LOCAL_MACHINE' branch of the registry until you see in
  1737.      the left pane an item called
  1738.      `HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem', then
  1739.      click on it.
  1740.    * The right pane now shows the list of values assigned to the `FileSystem'
  1741.      key.  If you don't see an item there called `NameNumericTail', select
  1742.      "New", "Binary Value" from the "Edit" menu, then type `NameNumericTail'
  1743.      and it will appear.  Now double-click on `NameNumericTail' and enter a
  1744.      value of 0.
  1745.    * Restart Windows 95.
  1746. If the `NameNumericTail' set to 0 breaks some programs, you can restore its
  1747. original setting after you've renamed the files as described above.
  1748. `NameNumericTail' only affects the short names of new files being created, it
  1749. has no effect on the files that already exist.
  1750. File: djgppfaq.info,  Node: C++ comments,  Next: Which language,  Prev: Missing C++ headers,  Up: Compiling
  1751. 8.3 GCC barfs on C++-style comments in C programs
  1752. =================================================
  1753. **Q*: My C program compiles OK with Borland's C, but GCC complains about
  1754. "parse error before `/' " at a line where I have a "//"-style comment.*
  1755. *A* :  That's because // isn't a comment neither in ANSI C nor in K&R C.
  1756. Borland and Microsoft C compilers support it as an extension.  GCC also
  1757. supports this extension (beginning with version 2.7.0), but using the `-ansi'
  1758. or `-traditional' switches to GCC disables this extension.  In general, it's
  1759. a bad practice to use this extension in a portable program until such time as
  1760. the ANSI C standard includes it.  If it's a C++ program, then rename it to
  1761. have a suffix which will cause gcc to compile it as such (*note list of
  1762. language-specific suffixes: Which language.), or use `-x c++' switch.  If
  1763. it's a C program, but you want to compile it as C++ anyway, try `-x c++'; it
  1764. can help, but can also get you in more trouble, because C++ has its own
  1765. rules.  For example, the following program will print 10 if compiled as a C
  1766. program, but 5 if compiled as C++:
  1767.          #include <stdio.h>
  1768.      
  1769.          int
  1770.          main ()
  1771.          {
  1772.            printf ("%d \n" 10    //*
  1773.                   / 2    //*/
  1774.                     1
  1775.                     );
  1776.            return 0;
  1777.          }
  1778. (While admittedly perverse, this little monstrosity was written with the sole
  1779. purpose of demonstrating that C and C++ have quite different semantics under
  1780. certain circumstances.)
  1781. If you must have both `-ansi' and C++-style comments, you can use the
  1782. `-lang-c-c++-comments' preprocessor switch.  Gcc doesn't accept the
  1783. `-lang-XXX' switches on its command line, so you will have to use the `-Wp'
  1784. option, like this:
  1785.       gcc -c -Wp,-lang-c-c++-comments myprog.c
  1786. Alternatively, you can add `-lang-c-c++-comments' to the `*cpp:' section of
  1787. your `lib/specs' file (but that will make it permanent).
  1788. Bottom line: until the future ANSI/ISO C standard includes this as part of
  1789. the C language, it's best to change those comments to C-style ones, if you
  1790. really mean to write a C program.  The following `Sed' command will convert a
  1791. C program with C++-style comments into a valid C source, provided you don't
  1792. have the string "//" in a character string:
  1793.       sed "s?//\(.*\)?/*\1 */?" file.c > newfile.c
  1794. Sed can be found in the DJGPP distribution, e.g.
  1795. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed118b.zip.
  1796. File: djgppfaq.info,  Node: Which language,  Next: Objective C,  Prev: C++ comments,  Up: Compiling
  1797. 8.4 How does GCC recognize the source language?
  1798. ===============================================
  1799. **Q*: I type `GCC PROG.CC' and GCC complains that it can't recognize
  1800. `PROG.CC''s file format.  How come a C++ compiler doesn't recognize a C++
  1801. source??*
  1802. **Q*: I type `GCC PROG.C' to compile a C program which I already remember to
  1803. pass compilation without a single warning, and suddenly it gives all kinds of
  1804. strange error messages and unresolved externals.*
  1805. *A* :  That's because you typed your source file extension in *upper* case.
  1806. GCC is *not* case-insensitive about filenames like DOS is, and it uses the
  1807. file's extension to determine how to compile a file.  Valid extensions are:
  1808. `.cc'
  1809. `.cxx'
  1810. `.cpp'
  1811.      C++ source (passed through cpp).
  1812.      C source that must be passed through cpp first.
  1813.      Raw C source (no cpp pass).
  1814. `.ii'
  1815.      Raw C++ source (not to be preprocessed).
  1816.      Objective-C source.
  1817.      Assembler that must be passed through cpp first.
  1818.      Raw assembler source (no cpp pass).
  1819. Any other file is passed to the linker, under the assumption that it's an
  1820. object file.
  1821. In the examples above, `PROG.C' is taken as a C++ program, not a C one, and
  1822. `PROG.CC' is passed to the linker as if it were an object file.  You can see
  1823. what GCC does by adding the `-v' switch to the GCC command line; if you see
  1824. that it's invoking `cc1plus.exe' (the C++ compiler) instead of `cc1.exe' (the
  1825. C compiler), or calling `ld.exe' (the linker) on a source file, then you'd
  1826. know this is your problem.  If you have problems keeping up with the verbose
  1827. GCC output caused by `-v', see *Note how to capture GCC output: Redirect, in
  1828. this FAQ.
  1829. You can override the default rules gcc uses to decide how each input file
  1830. should be treated, with the help of the `-x LANGUAGE' switch.  For instance,
  1831. the command
  1832.       gcc -x c++ prog.c
  1833. compiles `prog.c' as C++ source.  *Note -x LANGUAGE switch description:
  1834. (gcc)Overall Options, for more info on `-x' options.
  1835. File: djgppfaq.info,  Node: Objective C,  Next: DJGPP-specific,  Prev: Which language,  Up: Compiling
  1836. 8.5 Problems with Objective C
  1837. =============================
  1838. **Q*: How do I tell gcc my .cc file is to be compiled as Objective-C source?*
  1839. **Q*: I compile an Objective-C program, but get unresolved symbols.*
  1840. **Q*: I can't compile the Objective-C test program which came with DJGPP.*
  1841. *A* :  Give your sources the `.m' extension, or use `-x objective-c' switch
  1842. to GCC, so it will *know* you mean to compile with Objective C.
  1843. Objective-C was broken in GCC 2.6.0.  The problem manifests itself by
  1844. unresolved modules.  If you use that version, you'll have to upgrade to
  1845. version 2.6.3 or higher.
  1846. File: djgppfaq.info,  Node: DJGPP-specific,  Next: Unresolved externals,  Prev: Objective C,  Up: Compiling
  1847. 8.6 Writing codes fragments which are specific to DJGPP
  1848. =======================================================
  1849. **Q*: I must put a DJGPP-specific code fragment into my program.  What symbol
  1850. should I use in the `#ifdef' directive to make it only visible under DJGPP?*
  1851. *A* :  Use `__DJGPP__', like this:
  1852.          #ifdef __DJGPP__
  1853.          ... DJGPP-specific code ...
  1854.          #else
  1855.          ... not seen under DJGPP ...
  1856.          #endif
  1857. `__DJGPP__' has the value of the DJGPP major revision number, so you can
  1858. write code fragments which have different behavior under different versions
  1859. of DJGPP:
  1860.          #ifdef __DJGPP__
  1861.          #if __DJGPP__ > 2
  1862.          .... will work only in DJGPP v3.x and later ...
  1863.          #else
  1864.          .... get here for DJGPP v2.x ...
  1865.          #endif
  1866.          #else
  1867.          .... get here in DJGPP v1.x or non-DJGPP environment
  1868.          #endif
  1869. Another DJGPP-specific pre-processor symbol which DJGPP defines is
  1870. `__GO32__'; but it is only provided for compatibility with previous versions
  1871. of DJGPP (v1.x) and its use should be discouraged.
  1872. File: djgppfaq.info,  Node: Unresolved externals,  Next: Which library,  Prev: DJGPP-specific,  Up: Compiling
  1873. 8.7 Unresolved externals when linking programs
  1874. ==============================================
  1875. **Q*: Why do I get so many unresolved symbols when linking my programs?*
  1876. *A* :  By default, GCC instructs the linker to only look in two libraries:
  1877. `libgcc.a' and `libc.a.'  Some functions aren't included there, so the linker
  1878. can't find them.  GPL library routines, like obstack and regex packages are
  1879. in `libgpl.a' library; append `-lgpl' to the link command line to use them.
  1880. To use C++ classes in the `libgpp.a' (it's called `libg++.a' on Unix
  1881. systems), append `-lgpp.'  The Standard C++ Template classes are in
  1882. `libstdcx.a' (it's called `libstdc++.a' on Unix); append `-lstdcxx.'
  1883. When linking C++ programs, you can use the `gxx' instead of `gcc' command; it
  1884. will then instruct the linker to also scan the C++ libraries automatically,
  1885. so you don't have to remember doing that yourself.
  1886. Note that the first release of DJGPP v2.0 didn't include `gxx.exe' and the
  1887. C++ STL library `libstdcx.a.'  If you cannot find them on your machine,
  1888. download the latest `gcc272b.zip' and `lgp271b.zip' archives that are dated
  1889. 22-Feb-96 or later.
  1890. If your program uses a lot of floating-point math, or needs math functions
  1891. beyond those specified in the ANSI/ISO standard, consider appending `-lm' to
  1892. your link command line.  The basic math functions required by ANSI/ISO
  1893. standard are included in the `libc.a' library, but `libm.a' includes higher
  1894. quality versions of these functions, and also some functions not included in
  1895. the default library, like Gamma function and Bessel functions.
  1896. File: djgppfaq.info,  Node: Which library,  Next: Libraries' order,  Prev: Unresolved externals,  Up: Compiling
  1897. 8.8 How not to lose your head with all these libraries
  1898. ======================================================
  1899. **Q*: I'm lost with all those different libraries.  How in the world can I
  1900. find out which functions are included in which library?*
  1901. *A* :  You can use the `nm' program to check what functions are included in a
  1902. library.  Run it with the `-C' option and with the library as its argument
  1903. and look in the output for the name of your function (the `-C', or
  1904. `--demangle' option makes the function names look closer to what they are
  1905. called in the source file).  Functions which have their code included in the
  1906. library have a capital `T' before their name.  For example, the following is
  1907. a fragment from the listing produced by `nm':
  1908.          c:\djgpp\lib> nm --demangle libc.a
  1909.          .
  1910.          .
  1911.          .
  1912.          stdio.o:
  1913.          000000e4 b .bss
  1914.          000000e4 d .data
  1915.          00000000 t .text
  1916.          00000098 t L12
  1917.          0000001e t L3
  1918.          00000042 t L6
  1919.          0000004d t L7
  1920.          0000006a t L9
  1921.          00000000 t __gnu_compiled_c
  1922.               U _filbuf
  1923.               U _flsbuf
  1924.          00000000 T clearerr
  1925.          000000ac T feof
  1926.          000000c2 T ferror
  1927.          000000d8 T fileno
  1928.          0000000c T getc
  1929.          00000052 T getchar
  1930.          0000002a T putc
  1931.          0000007c T putchar
  1932.          00000000 t gcc2_compiled.
  1933.          .
  1934.          .
  1935.          .
  1936. Here we see that the module `stdio.o' defines the functions `clearerr',
  1937. `feof', `ferror', `fileno', `getc', `getchar', `putc' and `putchar', and
  1938. calls functions `_filbuf' and `_flsbuf' which aren't defined on this module.
  1939. Alternatively, you can call `nm' with the `-s' or `--print-armap', which will
  1940. print an index of what symbols are included in what modules.  For instance,
  1941. for `libc.a', we will see:
  1942.          c:\djgpp\lib> nm --print-armap libc.a
  1943.          .
  1944.          .
  1945.          .
  1946.          _feof in stdio.o
  1947.          _ferror in stdio.o
  1948.          _fileno in stdio.o
  1949.          .
  1950.          .
  1951.          .
  1952. which tells us that the functions `feof', `ferror' and `fileno' are defined
  1953. in the module `stdio.o.'
  1954. `nm' is fully described in the GNU docs. *Note the Binutils package docs:
  1955. (binutils)nm.
  1956. File: djgppfaq.info,  Node: Libraries' order,  Next: Still unresolved,  Prev: Which library,  Up: Compiling
  1957. 8.9 DJGPP uses a one-pass linker
  1958. ================================
  1959. **Q*: I give all the libraries to gcc, but I still get unresolved externals
  1960. when I link.  What gives?*
  1961. *A* :  `Ld' is a one-pass linker:  it only scans each library once looking
  1962. for unresolved externals it saw *until that point*.  This means the relative
  1963. position of object files and libraries' names on the command line is
  1964. significant.  You should put all the libraries *after* all the object files,
  1965. and in this order:
  1966.       -lgpp -lstdcxx -lgpl -lm
  1967. E.g., to link files main.o and sub.o into a C++ library, use the following
  1968. command line:
  1969.       gcc -o main.exe main.o sub.o -lgpp -lstdcxx -lgpl
  1970. or, if you compile and link in one command:
  1971.       gcc -o main.exe main.cc sub.cc -lgpp -lstdcxx -lgpl -lm
  1972. If you have any libraries of your own, put them *before* the above system
  1973. libraries, like this:
  1974.       gcc -o main.exe main.cc sub.cc -lmylib -lgpp -lstdcxx -lgpl -lm
  1975. When you use the `gxx' compilation driver to compile a C++ program, it names
  1976. the C++ libraries in the correct order.
  1977. If your installation tree is different from the default, i.e., if you keep
  1978. the libraries *not* in the default `lib/' subdirectory, then you should add
  1979. that directory to the line in the `[gcc]' section of your `DJGPP.ENV' file
  1980. which starts with `LIBRARY_PATH', or put into your environment a variable
  1981. called `LIBRARY_PATH' and point it to the directory where you keep the
  1982. libraries.  Note that if you invoke the linker by itself (not through the gcc
  1983. driver), then `LIBRARY_PATH' will have no effect, because this variable is
  1984. only known to the gcc driver.  So if you must call `ld' directly, use the
  1985. `-L' option to tell it where to look for the libraries.
  1986. File: djgppfaq.info,  Node: Still unresolved,  Next: Class Complex,  Prev: Libraries' order,  Up: Compiling
  1987. 8.10 C++ functions still not found
  1988. ==================================
  1989. **Q*: I put all the libraries in the above order, but the linker still can't
  1990. find some C++ functions from `complex.h' and `iostream.h.'*
  1991. *A* :  These functions are declared `inline' and defined on these header
  1992. files.  However, GCC won't inline them unless you compile with optimizations
  1993. enabled, so it tries to find the compiled version of the functions in the
  1994. library.  Workaround: compile with `-O.'
  1995. File: djgppfaq.info,  Node: Class Complex,  Next: Pure virtual,  Prev: Still unresolved,  Up: Compiling
  1996. 8.11 Where is class Complex?
  1997. ============================
  1998. **Q*: I cannot use class Complex in v2!  My C++ program compiled fine with
  1999. DJGPP v1.x, but in v2 the linker complains that it cannot find Complex class
  2000. definitions in the library.  Where are they?*
  2001. **Q*: I looked into libgpp.a and there aren't any references to any Complex
  2002. class functions.  I also didn't find complex.cc source file in the source of
  2003. Libg++ library.  Where did the Complex class go?*
  2004. *A* :  The latest Draft C++ Standard has changed its notion of complex
  2005. numbers, and the latest versions of Libg++ have followed suit.  Instead of
  2006. `class Complex' there is now a *template* `class complex<double>', and
  2007. `Complex' is now a typedef which uses that template class.  Look into the
  2008. headers `lang/cxx/_complex.h' and `lang/cxx/std/complext.h' and you will see
  2009. that change.  Part of the code found previously on `complex.cc' in the Libg++
  2010. source distribution is now found on `cdinst.cc' source file in the STL
  2011. sources (look inside `libstdcx.a'), another part is scattered between the
  2012. various files included at compile time (such as `lang/cxx/std/dcomplex.h' and
  2013. `lang/cxx/std/complext.cc'), while the rest is generated by the compiler
  2014. itself.  Therefore, there aren't any predefined functions of class Complex in
  2015. `libgpp.a.' Programs that use class Complex need to be edited to replace every
  2016. instance of `class Complex' to either just `Complex' or `class
  2017. complex<double>.'
  2018. As long as the C++ Standard is not officially published, C++ is still a
  2019. moving target, and Libg++ releases that try to track it sometimes have no
  2020. other alternative but to break existing code.  If you use C++, you have to
  2021. accept this as a fact of life.
  2022. File: djgppfaq.info,  Node: Pure virtual,  Next: djgpp_first_ctor,  Prev: Class Complex,  Up: Compiling
  2023. 8.12 The linker complains about __pure_virtual function.
  2024. ========================================================
  2025. **Q*: When I link a C++ program, the linker complains about "__pure_virtual"
  2026. being an unresolved symbol.  What should I do?*
  2027. *A* :  This problem is caused by a `libgcc.a' library which lacks a module
  2028. called `___pure_virtual' (yes, with *three* leading underscores!).  You
  2029. should get an updated version of that library which includes such a module.
  2030. `libgcc.a' comes with the Gcc distribution, so look in the latest
  2031. `gccNNNb.zip' file.
  2032. If, for some reason, you cannot find `libgcc.a' with that module, you can add
  2033. it yourself.  To this end, create a file called `pure.c' with this content:
  2034.      #define MESSAGE "pure virtual method called\n"
  2035.      
  2036.      void __pure_virtual()
  2037.      {
  2038.          write(2, MESSAGE, sizeof(MESSAGE) - 1);
  2039.          _exit(-1);
  2040.      }
  2041. Compile this file and put the object file into `libgcc.a', like this:
  2042.              gcc -c pure.c
  2043.              ar rvs libgcc.a pure.o
  2044. That's all!
  2045. File: djgppfaq.info,  Node: djgpp_first_ctor,  Next: Large image,  Prev: Pure virtual,  Up: Compiling
  2046. 8.13 Unresolved djgpp_first_ctor
  2047. ================================
  2048. **Q*: I do everything like your praised FAQ says, but the linker complains
  2049. about unresolved symbols with strange names like `djgpp_first_ctor',
  2050. `djgpp_last_dtor', etc.  I looked in every library with `nm', and I cannot
  2051. find these creatures.  Where in the world are they??*
  2052. *A* : These symbols are defined by the `djgpp.lnk' linker script that should
  2053. be in your `lib/' subdirectory.  When you call `gcc' to link a program, it
  2054. invokes `ld.exe' with the option `-Tdjgpp.lnk.'  If you invoke `ld' directly
  2055. (this is generally not recommended), be sure to include that switch.  If you
  2056. did invoke it through `gcc', maybe your linker is set up incorrectly.  Add
  2057. `-v' to the GCC switches and check that the command line that GCC gives to LD
  2058. includes that switch, that your `lib/' subdirectory includes that script
  2059. file, and that the script file is intact and includes the definition of the
  2060. above symbols.
  2061. Another reason might be that you have edited your `DJGPP.ENV' file in a way
  2062. that prevents the linker from finding its `djgpp.lnk' script.
  2063. Mixing an old v1.x installation with a v2.x one can also cause such problems.
  2064. Be sure to delete the entire v1.x tree, or rename it, before installing the
  2065. v2.x distribution.
  2066. File: djgppfaq.info,  Node: Large image,  Next: Large executable,  Prev: djgpp_first_ctor,  Up: Compiling
  2067. 8.14 C++ programs yield large `.exe' file
  2068. =========================================
  2069. **Q*: It seems that declaring a large `static' array has the effect of
  2070. bloating the program image on disk by that many bytes.  Surely there is a
  2071. more compact way of telling the loader to set the next N bytes of RAM to
  2072. zero?*
  2073. *A* :  This only happens in C++ programs and is a (mis-)feature of GCC.  You
  2074. can use the `-fconserve-space' switch to GCC to prevent this from happening,
  2075. but it also turns off the diagnostics of duplicate definitions, which, if
  2076. uncaught, might cause your program to crash.  Thus, this switch isn't
  2077. recommended for programs which haven't been completely debugged (if there is
  2078. such a creature).  The `-fconserve-space' switch is described in the GCC
  2079. docs, *Note GNU C Compiler docs: (gcc)C++ Dialect Options.
  2080. If the downside of using this switch doesn't deter you, you can even add this
  2081. switch to your `lib/specs' file to make it permanent.
  2082. File: djgppfaq.info,  Node: Large executable,  Next: Win95 LNK files,  Prev: Large image,  Up: Compiling
  2083. 8.15 Why are DJGPP `.exe' files so large?
  2084. =========================================
  2085. **Q*: I compiled a trivial "Hello world" program and got a 32KB executable
  2086. file.  That's ridiculously bloated!*
  2087. **Q*: How come I recompile my programs with v2, and my executables become
  2088. larger by some 20-30 KBytes?  Isn't the latest version supposed to be better?*
  2089. *A* :  In general, v2 programs are about 20-30K larger on disk, but use
  2090. 50-120K less memory at run-time, than v1.x programs.  The larger disk image
  2091. is due to two main factors:
  2092.    * Part of the code that used to be inside `go32' is now part of the
  2093.      library and thus gets linked into every program.
  2094.    * The v2 startup code is much more powerful, but also larger.
  2095. Judging code sizes by looking at the size of "Hello" programs is meaningless,
  2096. since most of the power of protected-mode programming goes wasted in such
  2097. programs.  There is no point in switching the processor to protected mode
  2098. (which requires a lot of code) just to print a 15-byte string and exit.  The
  2099. overhead induced by the code needed to set up the protected-mode environment
  2100. is additive; the larger the program, the smaller the overhead relative to the
  2101. program size.
  2102. Apart from getting to protected-mode, the DJGPP startup code also includes
  2103. such functionality as command-line argument expansion, long command-line
  2104. support, and loading the environment from a disk file; these usually aren't
  2105. available with other DOS protected-mode compilers.  Exception handling, FPU
  2106. detection and emulator loading, which were part of `go32' in v1.x, are now
  2107. also part of the startup code.
  2108. If your program doesn't need parts of the startup code, it can be made
  2109. smaller by defining certain functions with empty bodies.  These functions are
  2110. `__crt0_glob_function', `__crt0_load_environment_file', and
  2111. `__crt0_setup_arguments.' By defining empty substitutes for all three of
  2112. these, you can make the "Hello" program be 18KB on disk.
  2113. You can make your program image still smaller by compressing it with `DJP'
  2114. which is a DJGPP-specific executable compressor, e.g.
  2115. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/mlp104b.zip.  It is fast
  2116. and has no memory overhead.
  2117. And of course, don't forget to link with `-s' switch to `gcc', or to run
  2118. `strip' on the COFF output of the linker.  This strips off the debugging
  2119. symbols and makes the executable quite a lot smaller (not recommended except
  2120. when distributing production programs, because this makes debugging very hard
  2121. indeed).
  2122. Another cause for differences in executable sizes between v1.x and v2 might
  2123. be the code generated by GCC: DJGPP v2 uses a newer version of GCC.  Usually,
  2124. the code size is quite similar, but in some cases GCC 2.7.2 has been seen to
  2125. produce code which is 50% larger or 50% smaller than GCC 2.6.3 included with
  2126. v1.12.
  2127. File: djgppfaq.info,  Node: Win95 LNK files,  Next: No EXE,  Prev: Large executable,  Up: Compiling
  2128. 8.16 Linker complains about `djgpp.lnk'
  2129. =======================================
  2130. **Q*: I run DJGPP under Windows 95, but the linker complains about
  2131. `djgpp.lnk' file...*
  2132. *A* :  Do you have a shortcut to DJGPP in your current directory?  If so, and
  2133. if you call that shortcut `djgpp', Windows will create a file `djgpp.lnk' in
  2134. your working directory.  In that case, when `ld.exe' looks for its linking
  2135. script, it will find this file instead, and will be totally confused by its
  2136. format and contents.
  2137. File: djgppfaq.info,  Node: No EXE,  Next: Large object files,  Prev: Win95 LNK files,  Up: Compiling
  2138. 8.17 Linker fails to produce the EXE program under Novell
  2139. =========================================================
  2140. **Q*: When I link my program, it fails to produce the .EXE executable, but
  2141. only if I do this on a networked drive...*
  2142. **Q*: I run STUBIFY on a networked drive under Novell, but it doesn't produce
  2143. a .EXE file.  How come?*
  2144. *A* :  You might have another copy of the file with the same name that GCC is
  2145. creating in another directory somewhere on your networked drive.  If that
  2146. other directory is on your PATH, it is searched by Novell when the linker and
  2147. `STUBIFY' try to create the executable file, because that file doesn't exist
  2148. in the current directory.  So what might actually happen is that the linker
  2149. and `STUBIFY' are overwriting the files they find on your PATH instead of
  2150. creating new files in the current directory.
  2151. You can verify that this indeed is the problem by searching your networked
  2152. disks for files with the same name as those you are trying to build, and
  2153. looking at their time stamps.  If that is indeed the problem, then you have
  2154. several possible ways of solving it:
  2155.   1. You can remove the other files, rename them, or move them to another
  2156.      directory that isn't searched by Novell.
  2157.   2. You can rename the program you are trying to link.
  2158.   3. You can change the way Novell searches for files (aka "the search
  2159.      mode"), so that it won't look in the directories on your PATH.
  2160.   4. You can change your access rights to the directory on the PATH where the
  2161.      other files reside, so that you won't have write privileges to that
  2162.      directory.
  2163.   5. You can change the search mode for `STUBIFY' and the linker (or for any
  2164.      other program that gives you that trouble) by running commands like
  2165.      these:
  2166.             SMODE stubify.exe 2
  2167.             SMODE ld.exe 2
  2168. File: djgppfaq.info,  Node: Large object files,  Prev: No EXE,  Up: Compiling
  2169. 8.18 Linker fails for large object files or large libraries
  2170. ===========================================================
  2171. **Q*: Whenever I define very large static arrays in my program, the linker
  2172. fails saying "could not read symbols: Bad value".  Huh??*
  2173. **Q*: I have some large libraries that I cannot link because the linker fails
  2174. on them with a message saying "memory exhausted".  I have plenty of virtual
  2175. memory on my system, so why would ld fail?*
  2176. *A* :  This is a known bug in `ld.exe' from GNU Binutils 2.5.2.  Until it is
  2177. corrected in some future version, these are your alternatives for a
  2178. work-around:
  2179.    * In case of a large library, split it into several smaller ones.
  2180.    * For a module that defines large data structures, move some of the static
  2181.      data to other files, or allocate the space at runtime with `calloc.'
  2182. File: djgppfaq.info,  Node: Running,  Next: Graphics,  Prev: Compiling,  Up: Top
  2183. 9. Running Compiled Programs
  2184. ****************************
  2185.   This chapter discusses various problems which may happen when running DJGPP
  2186. programs under different environments, and gives solutions to them.
  2187. * Menu:
  2188. * v2.x crash::                Program which was OK in v1.x bombs in v2.0.
  2189. * Crash traceback::           How to make sense out of stack dumps.
  2190. * File data corrupted::       The DOS *TEXT*/*BINARY* file issue.
  2191. * Screen I/O::                Beware of the buffering!
  2192. * Distributing::              DJGPP programs are *not* self-contained.
  2193. File: djgppfaq.info,  Node: v2.x crash,  Next: Crash traceback,  Prev: Running,  Up: Running
  2194. 9.1 My program crashes only in v2.0!
  2195. ====================================
  2196. **Q*: I have this program which runs fine when compiled with DJGPP v1.12, but
  2197. crashes and burns in v2.0.  Isn't it obvious that you guys blew it with v2.0?*
  2198. **Q*: My v2.0 program crashes, but only under CWSDPMI; it runs OK under other
  2199. DPMI hosts like Windows, OS/2 or QDPMI.  Is this a bug in CWSDPMI?*
  2200. *A* :  Not necessarily so, it could still be a bug in your program which just
  2201. went unnoticed in v1.12.  One area where such things can happen is use of
  2202. uninitialized memory.  In v1.x, memory first allocated to the stack or by a
  2203. call to `malloc' is always zeroed, but v2.0 doesn't behave this way, so your
  2204. program might exhibit erratic behavior or crash with `SIGSEGV' because of
  2205. such bugs.  In particular, if the program behaves differently depending on
  2206. which program was run before it, you might suspect bugs of this kind.
  2207. To check whether this is the source of your grief, include the header
  2208. `crt0.h' in your `main' and set `_crt0_startup_flags' to
  2209. `_CRT0_FLAG_FILL_SBRK_MEMORY'; this will fill the memory with zeroes when it
  2210. is first allocated.  If the program will run OK after recompilation, then
  2211. this is probably the cause of your problem.  To make spotting uninitialized
  2212. memory simpler, you can set `_crt0_startup_flags' to
  2213. `_CRT0_FLAG_FILL_DEADBEAF' (don't laugh!); this will cause the sbrk()'ed
  2214. memory to be filled with the value `0xdeadbeaf' (`-559838801' in decimal)
  2215. which is easy to spot with a debugger.  Any variable which has this value was
  2216. used without initializing it first.
  2217. Another possible cause of problems will most probably be seen only under
  2218. CWSDPMI; its telltale sign is a message "Page fault at ..." that is printed
  2219. when a program crashes, and an error code of 6.  Unlike other DPMI hosts,
  2220. CWSDPMI supports some DPMI 1.0 extensions which allow DJGPP to capture and
  2221. disallow illegal dereference of pointers which point to addresses less than
  2222. 1000h (aka "NULL pointer protection").  This feature can be disabled by
  2223. setting the `_CRT0_FLAG_NULLOK' bit in `_crt0_startup_flags'; if this makes
  2224. SIGSEGV crashes go away, your program is using such illegal pointers; the
  2225. stack trace printed when the program crashes should be a starting point to
  2226. debug this.
  2227. An insufficient stack size can also be a cause of your program's demise, see
  2228. *Note setting the stack size: Stack size, below.
  2229. File: djgppfaq.info,  Node: Crash traceback,  Next: File data corrupted,  Prev: v2.x crash,  Up: Running
  2230. 9.2 What is that gibberish printed when my program crashes?
  2231. ===========================================================
  2232. **Q*: My program dies with a cryptic message like "Segmentation violation" or
  2233. "Unsupported DOS request" or "General Protection Fault" and prints some
  2234. funny-looking numbers.  Can't I get some decent human-readable traceback
  2235. information, so I could pinpoint where in the program did the problem happen?*
  2236. *A* :  Those "funny-looking numbers" *are* the traceback.  They describe the
  2237. sequence of function calls which led to the fatal error by giving you the
  2238. addresses where each function was called.  You can have these addresses
  2239. translated to source line numbers by using the `SYMIFY' program (it is
  2240. included in the djdev200.zip, e.g.
  2241. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djdev200.zip, and should be
  2242. in your `bin/' subdirectory).  To this end, make sure that your program was
  2243. compiled with the `-g' switch, linked *without* the `-s' switch and *not*
  2244. stripped, and that you have the source files available in your current
  2245. directory.  Now invoke your program and do whatever it takes to make it
  2246. crash.  Then, with the traceback still on the screen, type this from the DOS
  2247. command line:
  2248.       symify your-program-name
  2249. You will see the list of source files and line numbers right next to their
  2250. hex addresses.  Now you can start debugging.
  2251. You can ask `SYMIFY' to put the stack trace into a file (so you can consult
  2252. it later, e.g., from your editor while fixing the bug), by giving it an
  2253. output file, like this:
  2254.       symify -o problem.dmp yourprog
  2255. You can also save the raw stack trace (without source info) to a disk file
  2256. and submit it to `SYMIFY' later, like this:
  2257.       symify -i core.dmp yourprog
  2258. This comes in handy when your program grabs the screen (e.g., for some
  2259. graphics) and the stack trace can't be seen.  You can then *Note redirect the
  2260. stack trace to a file: Redirect, e.g., with the `REDIR' program which comes
  2261. with DJGPP.
  2262. But what if you *didn't* compile your program with `-g', and you aren't sure
  2263. how to recreate the problem which crashed it, after you recompile?  Well, you
  2264. can submit the stack dump *after* you recompile your program.  Just press
  2265. that PrintScreen key or otherwise save the stack trace, then submit it to
  2266. `SYMIFY' from a file as described above, after you've recompiled the program.
  2267. Be sure to give gcc all the compilation switches (sans `-s') that you gave
  2268. it when you originally compiled your program (in addition to `-g'), including
  2269. the optimization switches, or else the addresses shown in the stack trace
  2270. might be invalid.
  2271. File: djgppfaq.info,  Node: File data corrupted,  Next: Screen I/O,  Prev: Crash traceback,  Up: Running
  2272. 9.3 Reading and writing binary files
  2273. ====================================
  2274. **Q*: I'm reading/writing data files, but the data gets corrupted.*
  2275. **Q*: When I read a file I get only a small portion of it.*
  2276. *A* :  Are your data files binary?  The default file type in DOS is "text",
  2277. even when you use the `read' and `write' library functions.  Text files get
  2278. their Newlines converted to <CR>-<LF> pairs on write and vice versa on read;
  2279. reading in "text" mode stops at the first <^Z> character.  You must tell the
  2280. system that a file is binary through the `b' flag in `fopen', or `O_BINARY' in
  2281. `open', or use the `setmode' library function.
  2282. You can also use the low-level `_read' and `_write' library functions which
  2283. give you the direct interface to the DOS file I/O.
  2284. File: djgppfaq.info,  Node: Screen I/O,  Next: Distributing,  Prev: File data corrupted,  Up: Running
  2285. 9.4 Buffered screen I/O surprises
  2286. =================================
  2287. **Q*: My program prompts the user to enter data from the keyboard, then reads
  2288. its response.  When compiled with a 16-bit compiler like BCC or MSC it works
  2289. as expected, but with gcc the prompt doesn't show, or is printed much later
  2290. in the program.*
  2291. **Q*: Help!  I cannot make `gotoxy' work!  The text I print appears on the
  2292. screen in incorrect locations after I use `gotoxy'!*
  2293. **Q*: Why does the text appear in the default colors even though I call
  2294. `textcolor' and `textbackground'?*
  2295. *A* :  Do you write to screen using buffered I/O (`fprintf', `fputs' and the
  2296. like) functions, or send your output to the C++ `cout' stream?  Then what you
  2297. see is the effect of the buffering of the standard output streams.  The
  2298. buffer is not written to screen until it's full, or until a Newline is
  2299. output, which might produce very unpleasant and unexpected behavior when used
  2300. in interactive programs.
  2301. It is usually a bad idea to use buffered I/O in interactive programs; you
  2302. should instead use screen-oriented functions like `cprintf' and `cputs.'  If
  2303. you must use buffered I/O, you should be sure that both `stdout' and `stderr'
  2304. are line-buffered or unbuffered (you can change the buffering by calling the
  2305. `setvbuf' library function); another solution would be to `fflush' the output
  2306. stream before calling any input function, which will ensure all pending
  2307. output is written to the operating system.  While this will work under DOS and
  2308. DJGPP, note that some operating systems (including some DOS extenders) might
  2309. further buffer your output, so sometimes a call like `sync' would be needed
  2310. to actually cause the output be delivered to the screen.
  2311. The functions that set text attributes only affect the screen-oriented output
  2312. (aka "conio") functions (`cputs', `cprintf' etc.), the text written by
  2313. `fprintf' and other "stdio" functions doesn't change.  This is unlike some
  2314. 16-bit DOS compilers where `stdio' functions can also print colored text.
  2315. File: djgppfaq.info,  Node: Distributing,  Prev: Screen I/O,  Up: Running
  2316. 9.5 What do DJGPP programs need to run?
  2317. =======================================
  2318. **Q*: When I copy my DJGPP application program to another PC where no DJGPP
  2319. is installed, I can't run it.  It complains that it cannot find DPMI (??).
  2320. Do I really need all of your multi-megabyte installation to run compiled
  2321. programs?*
  2322. *A* :  No, you don't.  You can either (1) bring the `CWSDPMI.EXE' free DPMI
  2323. host to the target machine and put it in the same directory as your compiled
  2324. program or somewhere along the `PATH', or (2) install another DPMI host (such
  2325. as QDPMI, 386Max, Windows, etc.) on the target machine.  Note that the author
  2326. of CWSDPMI, Charles Sandmann <sandmann@clio.rice.edu>, requests a
  2327. notification by mail or acknowledged e-mail in case you distribute CWSDPMI
  2328. with a commercial or shareware product.
  2329. If your program could be run on a machine which lacks a floating-point
  2330. processor, you should also distribute an emulator, or link your program with
  2331. an emulator library.  *Note floating-point emulation issues: Emulation.
  2332. Future DJGPP releases might have a way to bind your executable with `CWSDPMI'
  2333. to produce a stand-alone program.  If you need such a feature *now* and if
  2334. you need it *badly*, write to Charles Sandmann <sandmann@clio.rice.edu> and
  2335. ask him about a modified stub code that creates an image of CWSDPMI if none
  2336. is found first time the program is run.
  2337. You can bind `PMODE/DJ' with your program, but remember that `PMODE/DJ'
  2338. doesn't support virtual memory, so such programs will only run on machines
  2339. with enough free physical RAM.
  2340. File: djgppfaq.info,  Node: Graphics,  Next: Floating point,  Prev: Running,  Up: Top
  2341. 10. Writing and Running Graphics Programs
  2342. *****************************************
  2343.   This chapter discusses some problems and explains some subtle points related
  2344. to graphics programming under DJGPP.
  2345. A tutorial is available on graphics programming with DJGPP, at this URL:
  2346.      http://remus.rutgers.edu/~avly/djgpp.html
  2347. * Menu:
  2348. * Which driver::         What driver to use with your SVGA?
  2349. * Direct access::        Under protected-mode it is (almost) forbidden.
  2350. * GRX and Windows::      Windows can mess up your graphics screen.
  2351. File: djgppfaq.info,  Node: Which driver,  Next: Direct access,  Prev: Graphics,  Up: Graphics
  2352. 10.1 What GRX driver to use with your SVGA
  2353. ==========================================
  2354. **Q*: Why won't GRX work with my SVGA adapter in any resolution but the
  2355. standard VGA?*
  2356. **Q*: How do I tell GRX which driver to use with my SVGA?*
  2357. *A* :  In order for GRX to work with your SVGA, you should set the `GRX20DRV'
  2358. environment variable, like this:
  2359.        set GRX20DRV=et4000 gw 1024 gh 768 nc 256
  2360. To set that variable, you need to know the chip-set on your adapter; refer to
  2361. your SVGA documentation.  Currently, GRX supports the following chip-sets:
  2362. `ati28800'
  2363.      The ATi 28800 chip-set.
  2364. `cl5426'
  2365.      Cirrus Logic CL-GD5426 or higher (like CL-GD5428) chip-set.
  2366. `et4000'
  2367.      Tzeng Labs ET4000 chip-set.
  2368. `mach64'
  2369.      The ATi Mach-64 SVGA.
  2370. `stdega'
  2371.      The standard EGA adapter.
  2372. `stdvga'
  2373.      The standard VGA adapter.
  2374. `VESA'
  2375.      For any VESA-compatible adapter.
  2376. After you set the `GRX20DRV' variable, run `modetest.exe' to see what modes
  2377. you have available.
  2378. If your chip-set is not one of the above, try the `VESA' driver because many
  2379. adapters support the VESA BIOS extensions.  If yours doesn't, try installing
  2380. a VESA BIOS emulator, like UNIVBE, e.g.
  2381. ftp://ftp.coast.net/Coast/msdos/graphics/univbe51.zip.
  2382. File: djgppfaq.info,  Node: Direct access,  Next: GRX and Windows,  Prev: Which driver,  Up: Graphics
  2383. 10.2 Accessing the video memory
  2384. ===============================
  2385. **Q*: I try to access the video memory at `0xa0000', but get "Segmentation
  2386. violation" ...*
  2387. **Q*: How can I access the text-mode video memory of my VGA?*
  2388. *A* :  Absolute addresses of memory-mapped devices are mapped differently
  2389. under DJGPP than what you might be used to under other DOS development
  2390. environments.  That's because DJGPP is a protected-mode environment, in which
  2391. you can't just poke any address:  that's what protected mode is all about!
  2392. To access such absolute addresses, use the so-called "farptr" functions like
  2393. `_farpeekb' and `_farpokew'; they are described in the C Library reference.
  2394. *Note more details on using "farptr" functions to access absolute addresses
  2395. in low memory: Xfer, below.
  2396. For text-mode screen updates, you can also use the `ScreenUpdate' and
  2397. `ScreenUpdateLine' library functions to quickly update the screen from a text
  2398. buffer.
  2399. Using the `_farpeekX/_farpokeX' paradigm to access memory isn't much slower
  2400. than direct access (they compile into 2 machine instructions when
  2401. optimizations are enabled).  But if you need even faster access (and don't
  2402. want to write it in assembly), *Note using the "nearptr" access facilities:
  2403. Xfer, as described below.
  2404. If your video card supports the VBE 2.0 standard, you can access the linear
  2405. frame buffer as a normal array in memory.  For an example of such a
  2406. technique, see the VBE example code by Charles Sandmann, e.g.
  2407. ftp://ftp.neosoft.com/pub/users/s/sandmann/vbe.zip.  You can also reach this
  2408. file via the Web, at this URL:
  2409.      http://www.rt66.com/~brennan/djgpp/vbe.zip
  2410. File: djgppfaq.info,  Node: GRX and Windows,  Prev: Direct access,  Up: Graphics
  2411. 10.3 Graphics screen restoring under Windows
  2412. ============================================
  2413. **Q*: When I switch away from my DJGPP program under Windows, then switch
  2414. back to it, graphics mode is down, or my screen is all messed up.  Why?*
  2415. *A* :  Windows only saves the VGA screen in standard VGA modes (1..13h) when
  2416. you switch away from a DOS application.  In any other mode it only
  2417. saves/restores the video mode *number*, but not the actual screen contents.
  2418. Your application is most likely still in the proper video mode (if not, it's
  2419. probably the fault of the Windows driver for your SVGA card), but the video
  2420. memory is messed up.  The beauty of all this is that your program has no way
  2421. of knowing that the screen has been taken away and then returned to it.
  2422. The only reasonable thing to do is to dedicate a "hotkey" in your application
  2423. (e.g., `Alt-R') whose action is to redraw the entire screen.  If you do that,
  2424. it's best to start all the way from the beginning, with a call to
  2425. `GrSetMode', as there are a few bad Windows video drivers which do not
  2426. restore SVGA graphics modes properly upon the switch back.
  2427. File: djgppfaq.info,  Node: Floating point,  Next: Debugging,  Prev: Graphics,  Up: Top
  2428. 11. Floating Point Issues and FP Emulation
  2429. ******************************************
  2430.   This chapter deals with issues pertaining to floating-point code and
  2431. floating-point emulation under DJGPP.
  2432. * Menu:
  2433. * Emulation::             What are your emulation options.
  2434. * Other emulators::       You can't use them.
  2435. * OS/2 emulation::        It doesn't serve DJGPP programs.
  2436. * -msoft-float::          This GCC switch isn't supported.
  2437. * Numeric exceptions::    Don't give us these NaN's!
  2438. * Emulator accuracy::     Not always as good as we'd like.
  2439. * SIGFPE with ObjC::      Objective C cannot run without FPU.
  2440. * SIGFPE in ldexp::       Some libm functions bomb.
  2441. File: djgppfaq.info,  Node: Emulation,  Next: Other emulators,  Prev: Floating point,  Up: Floating point
  2442. 11.1 Floating code without 80387
  2443. ================================
  2444. **Q*: I don't have an 80387.  How do I compile and run floating point
  2445. programs?*
  2446. **Q*: What shall I install on a target machine which lacks hardware
  2447. floating-point support?*
  2448. *A* :  Programs which use floating point computations and could be run on
  2449. machines without an 80387 should either be linked with the `libemu.a'
  2450. emulation library (add `-lemu' to your link command line) or be allowed to
  2451. dynamically load the `emu387.dxe' file at run-time if needed.  Linking with
  2452. libemu makes distribution simpler at a price of adding about 20KB to the size
  2453. of the program `.exe' file (the emulator functions will be used only if no
  2454. hardware floating point support is detected at runtime).  You should *always*
  2455. do one of the above when you distribute floating-point programs.
  2456. A few users reported that the emulation won't work for them unless they
  2457. explicitly tell DJGPP there is no x87 hardware, like this:
  2458.        set 387=N
  2459.        set emu387=c:/djgpp/bin/emu387.dxe
  2460. This is probably due to some subtle bug in the emulator setup code.  This
  2461. code is hard to debug, because the people who developed it have machines with
  2462. hardware FP processors.  Volunteers with FPU-less machines are needed to help
  2463. debug the above problem.  If you have access to a system without an FPU and
  2464. are willing to fix this problem, write to Charles Sandmann
  2465. <sandmann@clio.rice.edu> and ask him for guidance.
  2466. There is an alternative FP emulator called `WMEMU' (get the file
  2467. `v2misc/wmemu2b.zip').  It mimics a real coprocessor more closely, but is
  2468. larger in size and is distributed under the GNU General Public License (which
  2469. generally means you need to distribute its source if you distribute
  2470. `wmemu387.dxe', or distribute the source or objects to your entire program,
  2471. if you link it with `libwmemu.a').  Its advantage is that with `WMEMU', you
  2472. can debug FP apps on a non-FPU machine.  (But you will need to get the
  2473. sources and recompile it, since it was compiled with a beta release of DJGPP
  2474. and will cause unresolved externals if you try linking against `libwmemu.a'
  2475. without recompiling it.)  Note, however, that even `WMEMU' doesn't solve all
  2476. the problems of debugging FP programs on a non-FPU machine (e.g., emulating
  2477. flags doesn't work).
  2478. File: djgppfaq.info,  Node: Other emulators,  Next: OS/2 emulation,  Prev: Emulation,  Up: Floating point
  2479. 11.2 Other FP emulators cannot be used with DJGPP
  2480. =================================================
  2481. **Q*: I have an 80387 emulator installed in my `AUTOEXEC.BAT', but
  2482. DJGPP-compiled floating point programs still doesn't work.  Why?*
  2483. *A* :  DJGPP switches the CPU to *protected* mode, and the information needed
  2484. to emulate the 80387 is different.  Not to mention that the exceptions never
  2485. get to the real-mode handler.  You *must* use emulators which are designed
  2486. for DJGPP.
  2487. File: djgppfaq.info,  Node: OS/2 emulation,  Next: -msoft-float,  Prev: Other emulators,  Up: Floating point
  2488. 11.3 Floating-point emulation under OS/2
  2489. ========================================
  2490. **Q*: I run DJGPP in an OS/2 DOS box, and I'm told that OS/2 will install its
  2491. own emulator library if the CPU has no FPU, and will transparently execute
  2492. FPU instructions.  So why won't DJGPP run floating-point code under OS/2 on
  2493. my machine?*
  2494. *A* :  OS/2 installs an emulator for native OS/2 images, but does not provide
  2495. FPU emulation for DOS sessions.
  2496. File: djgppfaq.info,  Node: -msoft-float,  Next: Numeric exceptions,  Prev: OS/2 emulation,  Up: Floating point
  2497. 11.4 DJGPP doesn't support `-msoft-float'
  2498. =========================================
  2499. **Q*: I've read in the GCC Info file that gcc has a `-msoft-float' option
  2500. which is said to generate library calls for floating point support.  Can this
  2501. facility be used for FP emulation on a machine without x87?*
  2502. *A* :  The GCC Info file also says that the library required by
  2503. `-msoft-float' is *not* part of the GNU C compiler.  As nobody wrote such a
  2504. library for DJGPP (yet), this option currently isn't supported.
  2505. File: djgppfaq.info,  Node: Numeric exceptions,  Next: Emulator accuracy,  Prev: -msoft-float,  Up: Floating point
  2506. 11.5 Numeric exceptions--sometimes
  2507. ==================================
  2508. **Q*: I have a program which works with FP emulation, but dies with "Numeric
  2509. Exception" when run on a machine with a co-processor.  It also runs OK when
  2510. compiled with Microsoft C.  Can't you people make your floating-point code
  2511. right?*
  2512. *A* :  This might be still a problem with your program.  Under DJGPP, the
  2513. 80x87 control word is set up so that it generates an exception when your
  2514. program feeds it with a "NaN" ("Not a Number"), while the emulator doesn't
  2515. have this behavior.  You should make sure that your program doesn't generate
  2516. NaNs, or set the 80x87 control word to a different value.  There is a program
  2517. called ctrl87.c, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/ctrl87.zip,
  2518. which enables this kind of diddling of the 80x87 control word; check it out.
  2519. There is also a library function called `_control87' which can be used from
  2520. within a program to set the coprocessor to a non-default state.
  2521. File: djgppfaq.info,  Node: Emulator accuracy,  Next: SIGFPE with ObjC,  Prev: Numeric exceptions,  Up: Floating point
  2522. 11.6 Floating point inaccuracies when using emulator
  2523. ====================================================
  2524. **Q*: I am experiencing inaccurate results in some floating point
  2525. calculations, sometimes in the 2nd or 3rd significant digit (like getting
  2526. 118.401 instead of 120.0).  This is really unacceptable!  (And no, I'm *not*
  2527. using a buggy Pentium CPU.)*
  2528. *A* :  Are you using the emulator?  If so, it might be that the emulator
  2529. isn't as accurate as you expect.  One particular known problem is that it
  2530. does a bad job when computing the `atan' function.  So if you use `atan(1.)'
  2531. to get the value of `Pi', that might be your problem.  Solution: make `Pi' a
  2532. constant, as God intended.  The header file `<math.h>' includes the constant
  2533. `M_PI' which you can use; or get the value of Pi from the net, at this URL:
  2534.      http://www.diku.dk/~terra/pi.html
  2535. File: djgppfaq.info,  Node: SIGFPE with ObjC,  Next: SIGFPE in ldexp,  Prev: Emulator accuracy,  Up: Floating point
  2536. 11.7 Floating point exception in Objective-C programs
  2537. =====================================================
  2538. **Q*: When I run my Objective-C programs on a machine without an FPU, it dies
  2539. with a floating point exception, even though I installed the emulator as the
  2540. docs say...*
  2541. *A* : There is a bug in GCC 2.7.2 whereby it sometimes emits Objective-C code
  2542. that crashes ObjC programs.  A patch that fixes it was posted to the DJGPP
  2543. news group and can be found in the DJGPP mail archives, at this URL:
  2544.      http://www.delorie.com/djgpp/mail-archives/djgpp/1996/05/05/11:05:21
  2545. You will have to get the GCC source distribution `gcc272s.zip', install the
  2546. above patch, rebuild `cc1obj.exe', and then recompile `libobjc.a' to make the
  2547. problem go away.
  2548. File: djgppfaq.info,  Node: SIGFPE in ldexp,  Prev: SIGFPE with ObjC,  Up: Floating point
  2549. 11.8 Floating point exception in libm functions
  2550. ===============================================
  2551. **Q*: When I use the `ldexp' function, my program crashes with SIGFPE.
  2552. What's wrong?*
  2553. *A* : There is a bug in the scaling code in `libm.a' library released with
  2554. DJGPP v2.0 which affects several library functions such as `ldexp'.  A
  2555. work-around is to link without `-lm' switch; this will cause `GCC' to use
  2556. math functions from `libc.a'.  If you need math functions which are only in
  2557. `libm.a', or if you need `libm.a' for better numerical performance, a patched
  2558. version of libm is available, e.g.
  2559. ftp://ftp.lstm.ruhr-uni-bochum.de/pub/djgpp/libm.zip, courtesy of Tom Demmer
  2560. <Demmer@LStM.Rurh-Uni-Bochum.De>.  DJGPP v2.01 corrects this bug, so upgrade
  2561. to that version if and when it's available to you.
  2562. File: djgppfaq.info,  Node: Debugging,  Next: Profiling,  Prev: Floating point,  Up: Top
  2563. 12. Debugging DJGPP Programs
  2564. ****************************
  2565.   This chapter discusses the debuggers you can use with DJGPP and answers some
  2566. of the questions you might have when debugging DJGPP programs.
  2567. * Menu:
  2568. * How to debug::              What should you do to debug a program.
  2569. * Old QDPMI::                 Some QDPMI versions will crash the debugger.
  2570. * GDB needs COFF::            GDB can't use the .exe program.
  2571. * Transfer buffer::           Beware--debuggers use the transfer buffer.
  2572. * Debug graphics::            Debugging GUI programs.
  2573. * GDB and C++ source::        Problems with non-.cc extensions.
  2574. * C++ classes in GDB::        Class members' names in GDB.
  2575. * Included source::           Debuggers have problems with included files.
  2576. * Debugging woes::            Some programs which cannot be debugged.
  2577. File: djgppfaq.info,  Node: How to debug,  Next: Old QDPMI,  Prev: Debugging,  Up: Debugging
  2578. 12.1 How to run a DJGPP program under debugger
  2579. ==============================================
  2580. **Q*: How do I debug my programs?*
  2581. *A* :  First, remember to use the `-g' switch when you compile and link.
  2582. This puts debugging information into your executable.  When linking, don't
  2583. use the `-s' switch, and give the name of the output file *without the .exe
  2584. extension*, so that `gcc' will leave both the COFF output and the DOS
  2585. executable after the link stage.  Here are a few examples of compilation and
  2586. link command lines when you intend to debug a program:
  2587.       gcc -Wall -c -g -O myfile.c
  2588.      
  2589.       gcc -Wall -O2 -g -o myprog mymain.c mysub1.c mysub2.c -lm
  2590.      
  2591.       gcc -g -o myprog myprog.o mysub.o
  2592. (Note that with `gcc', you can use optimization switches when compiling with
  2593. `-g.')
  2594. Then, to debug the program, use a command line like this (here for `gdb'):
  2595.       gdb myprog
  2596. You can use one of several available debuggers with DJGPP:
  2597.   a. `FSDB', the full-screen debugger, from the `djdev' distribution.  This
  2598.      presents a user interface like that of Borland's Turbo Debugger, but
  2599.      unlike TD, *it isn't a source-level debugger* (although it will show the
  2600.      source code together with the machine instructions).  It also supports
  2601.      data-write breakpoints: a powerful feature for hunting down code which
  2602.      overwrites data it shouldn't touch.  Another advantage of `FSDB' is that
  2603.      you can easily debug programs that grab the screen, because it can
  2604.      switch between the debugger screen and the application screen.  The main
  2605.      disadvantage of `FSDB' is that you cannot easily examine the contents of
  2606.      complex data structures.  Remember to prepend an underscore `_' to the
  2607.      names of C identifiers when you use them with `FSDB'; for C++ programs
  2608.      you will have to find out the mangled names of static class variables
  2609.      and methods to make `FSDB' understand them.
  2610.   b. The GNU Debugger, `GDB' (get the file gdb412b.zip, e.g.
  2611.      ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/gdb412b.zip.  This is
  2612.      a powerful source-level debugger, but it uses a line-oriented user
  2613.      interface.  People who are familiar with using `GDB' on Unix should know
  2614.      about the following important differences in its operation on MS-DOS:
  2615.         * The command-line arguments can be only passed to the debuggee from
  2616.           within the debugger (use the `set args' or `run' commands), not
  2617.           from the `GDB' command line.
  2618.         * You cannot rerun the debuggee when it exits.  You must exit `GDB'
  2619.           and restart it.
  2620.         * `GDB' is currently configured for DJGPP in a way that makes loading
  2621.           a program and reading a source file when a breakpoint is hit
  2622.           *exceedingly* slow: it can take more than a minute for a very large
  2623.           program.  Be patient and don't decide that `GDB' is wedged unless
  2624.           you've waited several minutes.
  2625.         * `GDB' doesn't know about PC-specific keys, so you cannot use the
  2626.           arrow keys for command history editing.  Use ASCII control keys
  2627.           instead (`^F' for forward character, `^B' for backward character,
  2628.           `^P' for previous line, `^N' for next line, etc.).
  2629.         * The debugger and the debuggee share their file handles.  This means
  2630.           that if your program redirects or closes its `stdin' or `stdout',
  2631.           you will be unable to communicate with `GDB.'
  2632.         * The initial commands are read from a file named `gdb.ini' instead
  2633.           of `.gdbinit' which isn't a legal filename under MS-DOS.
  2634.         * `GDB' uses the GNU `readline' package for its input.  The
  2635.           `readline' init file (`~/.inputrc' on Unix) is called `inputrc' on
  2636.           MS-DOS and should be in the root directory of the current drive.
  2637.   c. `EDEBUG32' is the most basic debugger you can use with DJGPP.  One case
  2638.      when you would need to use it is when you debug a DXE module (*note
  2639.      explanation of what a DXE is: DXE.), because `GDB' doesn't support
  2640.      debugging DXEs.
  2641. You invoke any debugger like this:
  2642.       <debugger-name> <program> <args...>
  2643. Note that the `argv[0]' parameter under the debugger is *not* the full
  2644. pathname of the debuggee, so programs which use `argv[0]' for their operation
  2645. might behave differently under a debugger.
  2646. File: djgppfaq.info,  Node: Old QDPMI,  Next: GDB needs COFF,  Prev: How to debug,  Up: Debugging
  2647. 12.2 You need QEMM 7.53 or later
  2648. ================================
  2649. **Q*: Whenever I call any DJGPP debugger to debug my program, it crashes
  2650. immediately.*
  2651. *A* :  Are you running under Quarterdeck's QDPMI?  Then you should upgrade to
  2652. QEMM 7.5 patch-level #3 or later.  That patch corrects a subtle problem in
  2653. QDPMI which was triggered by the debugger.  If you cannot or wouldn't
  2654. upgrade, for money or love, turn OFF the DPMI services of QDPMI and use
  2655. `CWSDPMI' as your DPMI host.  To disable QEMM DPMI services either uninstall
  2656. QDPMI, or go to the QEMM directory and issue the following command:
  2657.       qdpmi off
  2658. File: djgppfaq.info,  Node: GDB needs COFF,  Next: Transfer buffer,  Prev: Old QDPMI,  Up: Debugging
  2659. 12.3 GDB won't debug unless it sees COFF output
  2660. ===============================================
  2661. **Q*: I try invoking GDB on my program, but it says: "not in executable
  2662. format: File format not recognized."  Huh?*
  2663. *A* :  Most probably, you've invoked GDB on a `.exe' program.  GDB needs to
  2664. be called with the name of un-stubbed COFF executable as its argument.  To
  2665. get both a `.exe' and a COFF file, you should make your link command line
  2666. look this way:
  2667.       gcc -o foo foo.o
  2668. instead of
  2669.       gcc -o foo.exe foo.o
  2670. (the latter will only produce `foo.exe', while the former produces both
  2671. `foo', the COFF executable which gdb needs, and `foo.exe').
  2672. To produce a COFF file from a `.exe' program, use the `EXE2COFF' program
  2673. which comes with DJGPP, like this:
  2674.       exe2coff foo.exe
  2675. File: djgppfaq.info,  Node: Transfer buffer,  Next: Debug graphics,  Prev: GDB needs COFF,  Up: Debugging
  2676. 12.4 Debuggers use the transfer buffer.
  2677. =======================================
  2678. **Q*: My program corrupts files and screen writes, and otherwise behaves
  2679. strangely when run under a debugger.*
  2680. *A* :  Do you use the transfer buffer to move data between your program and
  2681. conventional (under 1 MByte) memory?  Then it might be that the debugger
  2682. corrupts your I/O. The debugger itself uses the transfer buffer for disk read
  2683. requests and screen writes.  If you single step through any of your app
  2684. routines which use the transfer buffer, the debugger might overwrite its
  2685. contents, which may alter the correct behavior.
  2686. To work around this, don't step with the debugger through your functions
  2687. which use the transfer buffer.
  2688. If all of the above doesn't make sense for you, don't worry: if you don't
  2689. know what the transfer buffer is, and you only trace into your own functions,
  2690. then you won't hit this problem.
  2691. File: djgppfaq.info,  Node: Debug graphics,  Next: GDB and C++ source,  Prev: Transfer buffer,  Up: Debugging
  2692. 12.5 How to debug a graphics program
  2693. ====================================
  2694. **Q*: How can I debug a graphics program?  The debugger runs my program fine,
  2695. but when a breakpoint is hit with the screen in a graphics mode I can't read
  2696. the text printed by the debugger.*
  2697. *A* :  Redirect the debugger output to your printer, like this:
  2698.       gdb myprog > prn
  2699. This will only work if the program itself doesn't write to stdout (this is
  2700. usually the case with graphics programs); otherwise the debugger output will
  2701. get mixed up with your program's output.
  2702. The FSDB debugger can switch between the application screen and the debugger
  2703. screen, so you might use it, at a price of working with a low-level debugger.
  2704. Press `Alt-F5' to switch between the two screens.  Stock FSDB as distributed
  2705. with DJGPP can only do this with text screens, but a modified version of FSDB
  2706. with graphics support, e.g.
  2707. ftp://ftp.delorie.com/pub/djgpp/contrib/gnudebug.zip is available that knows
  2708. about many graphics modes (it can also be found on the Oulu repository, e.g.
  2709. ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/gnudebug.zip).
  2710. As yet another possibility, consider using the `MSHELL' program which will
  2711. redirect I/O from any program to the monochrome monitor at the BIOS level, so
  2712. you can use it even with GDB.  `MSHELL' was written by DJ Delorie
  2713. <dj@delorie.com> and is available as mshell10.zip, e.g.
  2714. ftp://ftp.delorie.com/pub/djgpp/ofc/mshell10.zip.  Be sure that you don't
  2715. have some other TSR installed that catches screen writes and bypasses the
  2716. BIOS functions, or else `MSHELL' won't help you.  For example, changing the
  2717. code page (with the DOS `CHCP' or `MODE' commands) might do this.
  2718. File: djgppfaq.info,  Node: GDB and C++ source,  Next: C++ classes in GDB,  Prev: Debug graphics,  Up: Debugging
  2719. 12.6 GDB finds only `.cc' source
  2720. ================================
  2721. **Q*: When I try to debug my C++ programs, the debugger claims it can't find
  2722. the source file:*
  2723.       file.cc: No such file or directory.
  2724. *The source file *is* there, but it's called `file.cpp', not `file.cc.'  Why
  2725. does this happen?*
  2726. *A* :  It's a bug in GCC.  It erroneously assumes that a C++ source always
  2727. has a `.cc' extension.  Until this bug is corrected in some future version of
  2728. GCC, you're better off calling your C++ files `*.cc.'  If this is
  2729. unacceptable, then you can work around this bug by invoking `cc1plus' and the
  2730. assembler pass manually.  The bug in GCC manifests itself in that `cc1plus'
  2731. is called with the option `-dumpbase file.cc.'  If you replace this with
  2732. `-dumpbase file.cpp' (or whatever your extension is), the debugger will
  2733. happily find your sources.
  2734. File: djgppfaq.info,  Node: C++ classes in GDB,  Next: Included source,  Prev: GDB and C++ source,  Up: Debugging
  2735. 12.7 Can GDB print class members?
  2736. =================================
  2737. **Q*: It seems that GDB doesn't recognize C++ class members by their
  2738. original, unmangled names.  Do I really need to figure out the mangled names
  2739. of all my class variables and methods to be able to debug them?*
  2740. *A* :  No, you don't.  `GDB' *does* allow you to use the original names, it's
  2741. just that it usually treats the `::' in their names as word delimiters.
  2742. Include the name of the method or a class static variable in single quotes,
  2743. and `GDB' will recognize them as a single word.  For example, if your class
  2744. `CMPForward' has a method named `go' which you need to put a breakpoint in,
  2745. use the following command:
  2746.        b 'CMPForward::go'
  2747. Other `GDB' features that might be useful in this context are the various
  2748. demangling options, like `set print demangle', `set demangle-style' etc.;
  2749. look them up in the GDB on-line docs.
  2750. File: djgppfaq.info,  Node: Included source,  Next: Debugging woes,  Prev: C++ classes in GDB,  Up: Debugging
  2751. 12.8 GDB cannot list source that was #include'd
  2752. ===============================================
  2753. **Q*: My source file #include's another source file, but I cannot set a
  2754. breakpoint in that included code, because GDB says there is no such line, or
  2755. no such source file...*
  2756. **Q*: I cannot debug code produced by Flex, or Bison, or F2C, because GDB
  2757. somehow messes up all the source file and line number info!*
  2758. *A* :  This is a genuine limitation of the COFF format used by DJGPP.  It can
  2759. only handle a single source file for a given object file.  It does include
  2760. correct line numbers, but the name of the source file is wrong, so debugging
  2761. such files just doesn't work.
  2762. For source files that include other source files, you can work around this by
  2763. just inserting the included source with your editor while you debug the
  2764. program.  For code produced by other programs, like `F2C' or `Bison', you
  2765. will have to delete the `#line' directives from the generated C source, and
  2766. debug the generated code as regular C program.
  2767. File: djgppfaq.info,  Node: Debugging woes,  Prev: Included source,  Up: Debugging
  2768. 12.9 Debuggers choke on some programs ...
  2769. =========================================
  2770. **Q*: I cannot debug Emacs (or any program that requests raw keyboard input):
  2771. when I press Ctrl-C, any debugger I tried reported SIGINT.  But I cannot
  2772. operate the debugged program without Ctrl-C (in Emacs, it's necessary to exit
  2773. the editor)!*
  2774. **Q*: I cannot debug any program which catches signals!!??*
  2775. **Q*: I compiled my program with `-pg' switch, and now I cannot debug it...*
  2776. **Q*: When my program hits a breakpoint in GDB, the debugger reports SIGSEGV,
  2777. but only under Windows...*
  2778. *A* : There are currently a few limitations in debugging programs which use
  2779. interrupts or exceptions.  Programs compiled for profiling may crash with
  2780. SIGSEGV or a GPF, with no addresses that `symify' can identify; programs
  2781. using `alarm' or `setitimer' can't be debugged, either.  You can't hook the
  2782. keyboard interrupt in a debugged program, and you can't debug a program which
  2783. uses floating point on a machine without FP hardware (unless you use `WMEMU'
  2784. as your emulator, but even WMEMU doesn't solve all the problems).  The reason
  2785. for all these problems is that any exceptions or signals that happen when
  2786. your program runs under a debugger will be caught by the debugger instead,
  2787. and they won't get passed to the debuggee.  To debug programs which hook
  2788. hardware interrupts, you will have to chain the old real-mode interrupt
  2789. handler to your new handler, which requires to write special debug version of
  2790. the program.
  2791. At least some of these limitations will be fixed in future versions of DJGPP.
  2792. For now, the only work-around that's available is for the case where you
  2793. need a `Ctrl-C' keypress to go to the debuggee instead of the debugger: use
  2794. the `Alt-Numeric-3' (that is, simultaneously press the `Alt' key and the `3'
  2795. key on the numeric keypad, then release the `Alt' key).
  2796. Several users reported that `GDB' GP Faults when the program hits a
  2797. breakpoint under Windows.  The only work-around is to use `FSDB' which works
  2798. in that environment.
  2799. File: djgppfaq.info,  Node: Profiling,  Next: Performance,  Prev: Debugging,  Up: Top
  2800. 13. Profiling DJGPP Programs
  2801. ****************************
  2802.   This chapter explains how to optimize your program for speed using the
  2803. profiler, and discusses some problems you might have with it.
  2804. * Menu:
  2805. * How to profile::           What should you do to profile a program.
  2806. * Gprof needs COFF::         Gprof doesn't like .exe executable.
  2807. * Gprof docs::               Look on Gprof man page for its docs.
  2808. * I/O bound programs::       How their profiles look.
  2809. * No profile::               Where is the profile?
  2810. File: djgppfaq.info,  Node: How to profile,  Next: Gprof needs COFF,  Prev: Profiling,  Up: Profiling
  2811. 13.1 How to profile a DJGPP program
  2812. ===================================
  2813. **Q*: How can I profile my program to see where it spends most of its run
  2814. time?*
  2815. *A* :  DJGPP includes a profiling facility.  To use it, compile and link with
  2816. `-pg' option, run your program as you usually would, then run a program
  2817. called `gprof':
  2818.       gprof myprog
  2819. (change `myprog' to whatever name your program is).  This will print an
  2820. execution profile.
  2821. `Gprof' is part of GNU Binutils distribution, e.g.
  2822. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu252b.zip.
  2823. File: djgppfaq.info,  Node: Gprof needs COFF,  Next: Gprof docs,  Prev: How to profile,  Up: Profiling
  2824. 13.2 Gprof won't work unless it can find COFF executable
  2825. ========================================================
  2826. **Q*: When I run `Gprof', it complains that it cannot find my program.  But
  2827. I've just run it!!*
  2828. **Q*: I run `Gprof' on my program, and it says: "bad format".*
  2829. *A* :  `Gprof' needs the original COFF file the linker produced.  If you
  2830. delete it, or feed `Gprof' with the `.exe' file instead, it will be most
  2831. unhappy.  The way to produce the COFF output is explained in the *Note
  2832. section dealing with GDB: GDB needs COFF, above.
  2833. File: djgppfaq.info,  Node: Gprof docs,  Next: I/O bound programs,  Prev: Gprof needs COFF,  Up: Profiling
  2834. 13.3 Where is Gprof docs?
  2835. =========================
  2836. **Q*: What about all those `Gprof' options?  Where can I find their docs?*
  2837. **Q*: I can't figure out some of the info in the `Gprof' report ...*
  2838. *A* :  `Gprof' is only documented on a man page, `gprof.1.'  If you don't
  2839. have one, you will have to look for it in the Binutils distribution, e.g.
  2840. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu252b.zip.
  2841. File: djgppfaq.info,  Node: I/O bound programs,  Next: No profile,  Prev: Gprof docs,  Up: Profiling
  2842. 13.4 Why is `__dpmi_int' so heavy used?
  2843. =======================================
  2844. **Q*: I've profiled my program and found that the routine which takes 60% of
  2845. the running time is some obscure library function called `__dpmi_int.'  Can't
  2846. you guys make your library right?*
  2847. *A* :  Does your program use I/O or other real-mode services (like BIOS)
  2848. extensively?  All those services are invoked through a DPMI service call
  2849. which is issued by `__dpmi_int.'  So what the profile really says is that the
  2850. running time of your program is governed by time-consuming operations such as
  2851. disk I/O.
  2852. File: djgppfaq.info,  Node: No profile,  Prev: I/O bound programs,  Up: Profiling
  2853. 13.5 `gprof' doesn't produce output
  2854. ===================================
  2855. **Q*: Every time I run the profiler it says "gmon.out: no such file or
  2856. directory" and no profile is produced.  What is this `gmon.out' and why won't
  2857. `gprof' compute the profile?*
  2858. *A* :  `gmon.out' is the file with raw execution counts and timing info that
  2859. `gprof' needs to produce the profile.  The file is written by the profiled
  2860. program when it exits.  If the file isn't created, it might be because one of
  2861. the following reasons:
  2862.    * You didn't compile and/or link your program with the `-pg' switch.  Note
  2863.      that *both* compilation and link need to be done with `-pg', because the
  2864.      functions that actually write the results to `gmon.out' are only linked
  2865.      in when `gcc' sees `-pg' on the link command line.
  2866.    * You have called `ld.exe' directly to link your program and forgot to
  2867.      mention the files and switches necessary for the profiled program
  2868.      operation.  You should use `gcc' to link your program instead of calling
  2869.      the linker directly; a `-pg' switch to `gcc' is all that it takes to
  2870.      make sure that the linker will get all the necessary arguments. (1)
  2871.      (*note No profile-Footnotes::)
  2872.    * Your program exited abnormally.  The function which generates `gmon.out'
  2873.      is registered with the `atexit' library function, which won't be called
  2874.      if the program was terminated in an abnormal way.  Make sure that your
  2875.      program exits with a call to `exit' or with a `return' statement in your
  2876.      `main' function.  For example, if your program dies with an exception or
  2877.      a signal, install a signal handler and make it call `exit.'
  2878. File: djgppfaq.info,  Node: No profile-Footnotes,  Up: No profile
  2879. (1)  If you absolutely need to call `ld.exe' directly, invoke `gcc' once with
  2880. a `-v' switch and you will see what the arguments are that you should pass to
  2881. the linker in your case.
  2882. File: djgppfaq.info,  Node: Performance,  Next: Memory,  Prev: Profiling,  Up: Top
  2883. 14. Run-time Performance of DJGPP Programs
  2884. ******************************************
  2885.   This chapter deals with issues pertinent to run-time performance of DJGPP
  2886. programs.
  2887. * Menu:
  2888. * How fast::                 What code quality should you expect.
  2889. * Faster v1::                Is v1.x faster than v2?
  2890. * Pentium::                  Is v2 slower on a Pentium?
  2891. * I/O speed::                Is I/O *really* so slow in protected mode?
  2892. * Slow-down::                What if your ported program runs slower?
  2893. File: djgppfaq.info,  Node: How fast,  Next: Faster v1,  Prev: Performance,  Up: Performance
  2894. 14.1 How efficient is DJGPP-generated code?
  2895. ===========================================
  2896. **Q*: How does DJGPP compare with other DOS-based C compilers in terms of
  2897. efficiency of generated code?*
  2898. **Q*: Won't my program run *much* slower when compiled by DJGPP, due to all
  2899. those CPU cycles wasted in switches between protected and real mode?*
  2900. *A* :  The quality of code generated by GCC with optimization turned on
  2901. (`-O2' switch to the compiler) is generally at least as good as what you will
  2902. get from top commercial products, like Borland, Microsoft and Watcom.  Mode
  2903. switches indeed have a certain performance hit, but in most programs it is
  2904. negligibly small, because only DOS and BIOS services require such a switch,
  2905. and most programs spend most of their time doing other things.
  2906. File: djgppfaq.info,  Node: Faster v1,  Next: Pentium,  Prev: How fast,  Up: Performance
  2907. 14.2 Comparing v2 with DJGPP v1.x
  2908. =================================
  2909. **Q*: I switched to v2 and my programs now run slower than when compiled with
  2910. v1.x...*
  2911. *A* :  In general, GCC 2.7.2 which comes with DJGPP v2.0 generates tighter,
  2912. faster code.  But it sometimes produces buggy code when "strength reduction"
  2913. optimizations are enabled.  So DJGPP by default disables this kind of
  2914. optimization, which might sometimes yield slower code.  If you need extra
  2915. speed, first debug your program with default optimization options, and then
  2916. recompile with `-fstrength-reduce' switch to see if that makes any difference.
  2917. GCC has a plethora of other optimization options which might make your code
  2918. faster; the best way to know is to profile and experiment.
  2919. File: djgppfaq.info,  Node: Pentium,  Next: I/O speed,  Prev: Faster v1,  Up: Performance
  2920. 14.3 Comparing v2 code on i486 vs Pentium
  2921. =========================================
  2922. **Q*: I run the same program on a 486 and on a Pentium, and it's slower on a
  2923. Pentium!!*
  2924. *A* : This might be due to alignment problems in DJGPP.  GCC makes
  2925. assumptions about how GAS (the assembler) handles alignment, but when GAS is
  2926. built with the default DJGPP configuration, it treats alignment in a way
  2927. that's different from what GCC assumes.  The outcome of this is that longs
  2928. are word-aligned, doubles are dword-aligned, etc.  Depending on the DJGPP
  2929. version, link order, library differences, you might get lucky (or unlucky)
  2930. with a 50/50 chance to get an improper alignment.  Different CPUs have
  2931. different penalties for unaligned accesses, which may explain what you see.
  2932. You might consider adding some slack static variables to induce changes in
  2933. alignment; if any of the changes suddenly cause a significant change in the
  2934. runtime performance, then alignment might be the reason.
  2935. File: djgppfaq.info,  Node: I/O speed,  Next: Slow-down,  Prev: Pentium,  Up: Performance
  2936. 14.4 My program's I/O is so slow!
  2937. =================================
  2938. **Q*: I measured the time required to read a 2 MByte file in DJGPP and in
  2939. Borland C.  It took the DJGPP program 2.5 seconds to do it, while Borland did
  2940. it in just under 2.  Isn't that *horribly* slow performance??*
  2941. **Q*: I tried to improve DJGPP I/O throughput by defining a 64KB-large buffer
  2942. for buffered I/O with a call to `setvbuf', but that had no effect.  Why is
  2943. that?*
  2944. *A* :  Doing I/O from protected-mode programs requires that low-level library
  2945. functions move the data between the extended memory and low memory under the
  2946. 1 MByte mark, where real-mode DOS can get at it.  This area in the low memory
  2947. is called the "transfer buffer".  This data shuffling means that some I/O
  2948. speed degradation is inevitable in any protected-mode program which runs
  2949. under DOS.  By default, DJGPP moves data in chunks of 16 KB, so defining a
  2950. buffer larger than that won't gain anything.  The size of transfer buffer is
  2951. customizable up to a maximum of 64 KB, so if your program really reads a lot
  2952. of large files, you might be better off enlarging it (with the `STUBEDIT'
  2953. program).
  2954. That said, I would like to point out that waiting another 0.5sec for reading
  2955. a 2 MByte file isn't that bad: it is indeed about 25% longer than you can do
  2956. under DOS, but it's only half a second...  Besides, most programs read and
  2957. write files which are only a few hundreds of kilobytes, and those will suffer
  2958. only a negligible slow-down.
  2959. File: djgppfaq.info,  Node: Slow-down,  Prev: I/O speed,  Up: Performance
  2960. 14.5 My ported program runs much slower!
  2961. ========================================
  2962. **Q*: How come my program, which I ported from Borland/MS C and which doesn't
  2963. use much I/O, still runs much slower under DJGPP? *
  2964. *A* :  Explore the following possible causes for this:
  2965.   a. Your program extensively calls services other than I/O which require mode
  2966.      switch (like BIOS Int 10h, mouse services, etc.).
  2967.      You can tell how much your program switches to real mode by profiling
  2968.      your program.  In the profile, look at the proportion of time your
  2969.      program spends in low-level library functions called `__dpmi_int' (which
  2970.      calls real-mode DOS/BIOS services) and `__dj_movedata' (which moves data
  2971.      between the transfer buffer and your program).  If this proportion is
  2972.      large, try rewriting your program to minimize use of those functions
  2973.      which require a mode switch, even at a price of more computation (a mode
  2974.      switch usually eats up hundreds of CPU cycles).
  2975.   b. Your program uses library functions/classes which are implemented less
  2976.      efficiently by GCC.  Or you might be a heavy user of functions which
  2977.      other compilers convert to inline code, while GCC doesn't inline most
  2978.      library functions.  If this is the case, you will see those functions as
  2979.      "hot spots" on the program histogram produced by the `Gprof' profiler.
  2980.      If you find this to be the problem, write your own, optimized versions of
  2981.      those functions.  It's best to write them as inline assembly functions,
  2982.      for maximum performance.  If you find library functions which are
  2983.      inefficient, please inform the DJGPP news group by posting to the
  2984.      comp.os.msdos.djgpp news group, so this could be fixed by people who
  2985.      maintain the library.
  2986.   c. If your program spends most of its time in a certain innermost loop, you
  2987.      might try enabling the strength-reduction optimizations.  This is
  2988.      disabled by default, because GCC has a known bug which sometimes causes
  2989.      it to generate incorrect code when this kind of optimization is enabled.
  2990.      If you decide to enable it, examine the behavior and the output of your
  2991.      program carefully, to be sure you didn't hit that bug.
  2992. File: djgppfaq.info,  Node: Memory,  Next: Command line,  Prev: Performance,  Up: Top
  2993. 15. Run-Time Memory Issues
  2994. **************************
  2995.   This chapter answers questions which are related to DJGPP run-time memory
  2996. allocation.
  2997. * Menu:
  2998. * How much memory::        How much can you use?
  2999. * Confusing alloc::        Allocation mechanism peculiarities.
  3000. * QDPMI VM::               QDPMI doesn't provide virtual memory.
  3001. * QDPMI alloc::            QDPMI/Win 95 memory allocation peculiarities.
  3002. * Windows alloc::          VM issues under Windows 3.x.
  3003. * Win9x alloc::            VM peculiarities under Win9x.
  3004. * EMM386 alloc::           Some versions of EMM386 are limited to 32 MBytes.
  3005. * Swap out::               How much VM do spawned program have?
  3006. * Stack size::             How large is the stack and how to enlarge it?
  3007. File: djgppfaq.info,  Node: How much memory,  Next: Confusing alloc,  Prev: Memory,  Up: Memory
  3008. 15.1 How much virtual memory do you have?
  3009. =========================================
  3010. **Q*: How much virtual memory can I use in DJGPP programs?*
  3011. *A* :  That depends on the DPMI host you are using.  CWSDPMI (the free DPMI
  3012. host which comes with DJGPP) will let you use all available conventional and
  3013. extended memory (up to 128M) and up to 128M of disk space, for a grand total
  3014. of 256M of virtual memory for your application.  Try a `malloc(50*1024*1024)'
  3015. some day.
  3016. With other DPMI hosts, your mileage may vary.  Quarterdeck's QDPMI, for
  3017. instance, has a bug in some of its versions which effectively disables
  3018. virtual memory under DJGPP (described under *Note QDPMI VM bug: QDPMI VM,
  3019. below), so you only have whatever free physical RAM is left.  Under Windows
  3020. 3.x, the amount of virtual memory you get depends on various virtual memory
  3021. settings in the Control Panel and on the `.pif' file settings for the program
  3022. you run (see *Note Windows allocation subtleties: Windows alloc, below).
  3023. Under Windows 9x, the memory settings of the DOS Applications' Property Sheet
  3024. define how much virtual memory a DJGPP program will get (see *Note Win9x
  3025. allocation details: Win9x alloc, below).
  3026. File: djgppfaq.info,  Node: Confusing alloc,  Next: QDPMI VM,  Prev: How much memory,  Up: Memory
  3027. 15.2 It seems `malloc'/`free' don't affect virtual memory...
  3028. ============================================================
  3029. **Q*: I did `malloc(50*1024*1024)', but didn't see any paging happen, and I
  3030. only have 8 MBytes of RAM on my machine.  Is this virtual memory thing for
  3031. real?*
  3032. **Q*: I `malloc''ed a large chunk of memory, but when I check values returned
  3033. by `_go32_remaining_physical_memory' or `__dpmi_get_memory_information', I
  3034. don't see any change...*
  3035. **Q*: When I `free' allocated RAM, `_go32_remaining_physical_memory' reports
  3036. there was no change in the available RAM.*
  3037. *A* :  CWSDPMI (and, possibly, other DPMI hosts) only pages in memory when it
  3038. is actually accessed.  If you only `malloc' it, but don't actually access it,
  3039. it won't grab those pages.  Try `calloc' and see the *big* difference.
  3040. When you call `free', DJGPP library doesn't return memory to the system, it
  3041. just adds it to its internal pool of free pages.  So, from the system point
  3042. of view, these pages are not "free".
  3043. File: djgppfaq.info,  Node: QDPMI VM,  Next: QDPMI alloc,  Prev: Confusing alloc,  Up: Memory
  3044. 15.3 Failure to get more memory than is physically installed
  3045. ============================================================
  3046. **Q*: When I try to access more memory than the free physical RAM, `malloc'
  3047. returns a `NULL' pointer, or I get some cryptic error message like this:*
  3048.      DPMI: Not enough memory (0x00860000 bytes)
  3049. *or like this:*
  3050.      QDPMI: Memory Paging Violation: Illegal Page Reference [PTE=0000-0000h]
  3051.             [CR2=8006-3000h at 00E7h:0000-4936h]
  3052.      
  3053.      QDPMI: Unrecoverable Exception: 000Eh at 00E7h:0000-4936h.  Error Code = 0006h
  3054. *A* :  This is typical of Quarterdeck's DPMI host called QDPMI which comes
  3055. with QEMM386 version 7.53 and earlier.  Some versions of QDPMI (those which
  3056. come with QEMM v6.x) fail to resize memory blocks when the new size is more
  3057. than the available physical RAM, even though virtual memory services are
  3058. enabled; other versions (those which come with QEMM v7.x) just don't let you
  3059. allocate more memory than is physically available.  If you must use more RAM
  3060. than is physically available, *Note disable or uninstall QDPMI: Old QDPMI,
  3061. and use CWSDPMI instead.
  3062. This bug was corrected in QDPMI version 1.10 or later, distributed with QEMM
  3063. beginning with version 8.0, so upgrading to the latest version of QEMM might
  3064. also be a solution.  With QEMM 6.x, make sure your programs don't override
  3065. the default type of `sbrk' behavior by setting `_crt0_startup_flags' to
  3066. `_CRT0_FLAG_UNIX_SBRK' (QEMM 8.0 and later can allocate virtual memory with
  3067. both types of `sbrk' algorithm).
  3068. If you use another DPMI host, make sure that virtual memory is enabled.
  3069. E.g., for 386Max, include the `swapfile=' parameter to establish a virtual
  3070. memory swap file; you can make it permanent (this will speed up DJGPP
  3071. start-up) with the `/p' option.
  3072. File: djgppfaq.info,  Node: QDPMI alloc,  Next: Windows alloc,  Prev: QDPMI VM,  Up: Memory
  3073. 15.4 Memory allocation fails before all memory is used
  3074. ======================================================
  3075. **Q*: OK, I've changed my program to never allocate more memory than is
  3076. physically available, to work around that *Note QDPMI VM bug: QDPMI VM, but
  3077. my program still gets a `NULL' pointer from `malloc/calloc'!*
  3078. **Q*: Why is my program dying with SIGSEGV under CWSDPMI when allocating a
  3079. chunk of memory?*
  3080. *A* :  Another peculiarity of QDPMI which came with QEMM before version 8.0:
  3081. it will never let you allocate a chunk which is larger than half of what's
  3082. available.  The Windows 3.x behaves in the same way, and several people
  3083. reported the same to be true under Windows 95.
  3084. With some DPMI providers, this behavior might be triggered by a small
  3085. overhead of each `malloc' call: you might ask for half of available memory,
  3086. but the DJGPP implementation of `malloc' adds the overhead and then rounds
  3087. the amount of memory to the next power of 2 before calling `sbrk'; thus
  3088. `malloc(8MB + 1)' will actually request 16MBytes from the DPMI host.  When in
  3089. doubt, call `sbrk' directly, especially if you don't plan to free that memory
  3090. during execution.
  3091. If your program asks for memory in lots of small allocations, then it might
  3092. crash when you use CWSDPMI as your DPMI host.  This is because CWSDPMI runs
  3093. out of its memory where it tracks memory allocations.  If you use release 1
  3094. of CWSDPMI, you can enlarge the maximum space that CWSDPMI uses if you get a
  3095. CWSDPMI heap-fix patch, e.g.
  3096. ftp://ftp.neosoft.com/pub/users/s/sandmann/csdpmi1heapfix.zip.  Beginning
  3097. with release 2, CWSDPMI defines a larger (6KB) default heap that is
  3098. configurable by CWSPARAM program to be anywhere between 3K and 40K bytes,
  3099. without recompiling CWSDPMI.  You should upgrade to the latest CWSDPMI if you
  3100. experience such problems.
  3101. File: djgppfaq.info,  Node: Windows alloc,  Next: Win9x alloc,  Prev: QDPMI alloc,  Up: Memory
  3102. 15.5 Memory allocation fails under Windows
  3103. ==========================================
  3104. **Q*: I'm running under Windows 3.x DOS box, but DJGPP complains about there
  3105. not being enough DPMI memory, although virtual memory is enabled.*
  3106. *A* :  You must make sure the size of your Windows swap file can be at least
  3107. 2 times the largest virtual memory size you need.  Check if you have enough
  3108. free disk space; if you do, run a defragger (Windows needs the swap file to
  3109. be contiguous).  This size is normally limited by the the "virtual = 4 times
  3110. free physical" rule, but you can change that by inserting the line
  3111.       PageOverCommit=n
  3112. in the `[386Enh]' section of your `SYSTEM.INI' file.  The parameter `n' is 4
  3113. by default, but can be set to be as large as 20.
  3114. File: djgppfaq.info,  Node: Win9x alloc,  Next: EMM386 alloc,  Prev: Windows alloc,  Up: Memory
  3115. 15.6 Memory allocation peculiarities under Windows 9x
  3116. =====================================================
  3117. **Q*: I seem to be unable to get more than 16 MBytes of virtual memory under
  3118. Windows 95, even though I have 32 MBytes of RAM installed on my machine, and
  3119. a lot of disk space...*
  3120. *A* :  You must set the maximum amount of DPMI memory to 65535K in the DOS
  3121. applications' property sheet.  If you leave that setting at the default
  3122. "Auto", you only get 16 MBytes.  You must actually type 65535 inside the
  3123. dialog box, as checking out the values from the list Windows offers will
  3124. never get you past 16384 (i.e., 16MB).
  3125. Note that you cannot allocate more than half the available memory in one
  3126. chunk under Windows 9x, exactly as the things are under Win3.x.
  3127. File: djgppfaq.info,  Node: EMM386 alloc,  Next: Swap out,  Prev: Win9x alloc,  Up: Memory
  3128. 15.7 Memory allocation fails under EMM386 or HIMEM
  3129. ==================================================
  3130. **Q*: My machine has 48 MBytes of RAM, but when I run DJGPP programs, they
  3131. start paging after 32 MBytes have been used...*
  3132. **Q*: I have 5 MBytes of free RAM on my machine, but DJGPP programs start
  3133. paging after only 256KBytes of memory were used??*
  3134. *A* :  This might be caused by some old versions of the memory manager
  3135. installed in your machine (like HIMEM or EMM386 from an old version of DOS),
  3136. which were limited to 32 MBytes of expanded memory.  Try running without them
  3137. (CWSDPMI can use raw extended memory), or upgrade to a newer version of DOS.
  3138. If your programs start paging after only 256KBytes of memory were used, most
  3139. probably you are using EMM386 and CWSDPMI, and your `CONFIG.SYS' specifies no
  3140. amount of memory when it installs EMM386.  EMM386 defaults to 256K in this
  3141. case; you should tell EMM386 explicitly how much memory it should take over.
  3142. You can use the `go32-v2' program to see what amount of extended memory your
  3143. DJGPP programs will get.
  3144. File: djgppfaq.info,  Node: Swap out,  Next: Stack size,  Prev: EMM386 alloc,  Up: Memory
  3145. 15.8 How much memory do parent DJGPP programs leave for their child?
  3146. ====================================================================
  3147. **Q*: How much memory is available when I call the `system' library function?*
  3148. *A* :  In the conventional (below 640K mark) memory, you are left with
  3149. everything which was free before your program started, except what the DPMI
  3150. host uses.  The amount of conventional memory required by the DPMI host
  3151. depends heavily on the host you use.  For the first DJGPP program, QDPMI uses
  3152. about 97K, CWSDPMI uses about 70K, Windows 3.x only 18 KBytes.  Each
  3153. subsidiary call to `system' (like in recursive invocation of `Make') eats up
  3154. about 18K (16K for the transfer buffer and 2K for the PSP and environment)
  3155. for most DPMI servers; a notable exception is QDPMI which needs 97K bytes of
  3156. low memory for the subsequent calls too.  If you change the size of the
  3157. transfer buffer (with `STUBEDIT'), the amount of free conventional RAM will
  3158. change accordingly.
  3159. Extended memory management is left to the DPMI server; DJGPP does nothing
  3160. special about XMS when `system' is called.  This means that all the extended
  3161. memory used by the parent program is *not* freed when the child program
  3162. starts; if the child requests more memory than is physically free, the DPMI
  3163. server is expected to page some of the parent out to honor the request.
  3164. (This is unlike DJGPP v1.x, where the `go32' extender would completely page
  3165. out the parent before starting the child.)  The advantage of this is that
  3166. spawning a child or shelling out is much faster in v2.0 than it used to be
  3167. with v1.x, except on machines with low amounts of installed RAM.  A
  3168. disadvantage is that if you spawn a real-mode program that uses XMS, the
  3169. extended memory used up by your DJGPP program will be unavailable to it,
  3170. unless you use a memory manager (as opposed to when CWSDPMI uses raw XMS or
  3171. HIMEM).  The only way around this problem is to buy more RAM, or to install a
  3172. real memory manager.
  3173. File: djgppfaq.info,  Node: Stack size,  Prev: Swap out,  Up: Memory
  3174. 15.9 How much stack can I have in DJGPP programs?
  3175. =================================================
  3176. **Q*: My program bombs when I use very large automatic arrays.*
  3177. **Q*: How much stack space do I have in my program?*
  3178. **Q*: My program seems to overflow the stack, but only when I run it under a
  3179. debugger...*
  3180. **Q*: My program crashes with SIGSEGV, but the traceback makes no sense: it
  3181. points to something called ___djgpp_exception_table...  When I try to debug
  3182. this, the traceback mysteriously changes to some innocent library function,
  3183. like getc().  The same program works flawlessly when compiled with DJGPP v1.x
  3184. What's going on??*
  3185. *A* : DJGPP v2.0 programs impose a limit on the maximum stack size; this is a
  3186. bug/feature of the DPMI 0.9 specification.  By default, you have a 256KB-long
  3187. stack, but some programs which use large automatic arrays, or are deeply
  3188. recursive, might need more.  If the default stack size is not enough, you can
  3189. change it with the `STUBEDIT' program (change the parameter "Minimum amount
  3190. of stack space"), or by setting the global variable `_stklen' in your
  3191. program.  Example:
  3192.       unsigned _stklen = 1048576;  /* need a 1MB stack */
  3193. The DJGPP startup code checks both these values and uses the largest of the
  3194. two.  Therefore, programs that are known to require large stack size should
  3195. set `_stklen' to make sure they will always work, even if somebody stub-edits
  3196. them to a lower value.  This technique is also safer when you need to debug
  3197. your program with `gdb' (see below).  However, you might need to use
  3198. `STUBEDIT' with programs for which you don't have the sources.
  3199. Programs which needs an unusually large stack might crash with bogus stack
  3200. traces, because part of the heap gets overwritten by the overflowing stack.
  3201. To see if that is the cause of such crashes, run `STUBEDIT' on your program
  3202. and crank up the stack size to a large value (like 4MBytes).  If that makes
  3203. the problem go away, tune the stack limit to the minimum value your program
  3204. can live with, then set `_stklen' to an appropriate value as explained above
  3205. and recompile the program.  (Some DPMI hosts will actually allocate the
  3206. entire stack, even if not all of it is used, so leaving it at unnecessarily
  3207. large value will hurt the program on low-memory machines.)
  3208. Some users have reported that they needed to enlarge the stack size of the
  3209. C++ compiler, `cc1plus.exe', to prevent it from crashing when compiling some
  3210. exceedingly large and complex C++ programs.  Another program that was
  3211. reported to need a stack larger than the default is `bccbgi.exe' from the
  3212. `BCC2GRX' package.
  3213. After you've used `STUBEDIT' to change the stack size, run it again to make
  3214. sure it displays as default the value you thought you entered.  This is
  3215. because `STUBEDIT' will sometimes silently set the stack size to 0 (and then
  3216. you will get the default 256K stack) if it doesn't like the value you type.
  3217. When you run a program as an un-stubbed COFF image under a debugger, the
  3218. stack size comes from the debugger.  So if your program needs a large stack
  3219. and you run it under `gdb' (which always requires a COFF image of the
  3220. debuggee), be sure to stubedit `gdb' to enlarge its stack to at least the
  3221. value your program needs to run safely.
  3222. Under Windows, be sure you've allocated a sufficiently large swap file (let's
  3223. say, 40MBytes) from the Windows' Control Panel, and make sure the `.PIF' file
  3224. for your program doesn't have too low limit on EMS/XMS usage (better make
  3225. them both -1).  What's that?  You don't have a `.PIF' file for this program?
  3226. Then Windows uses the default file `DOSPRMPT.PIF', which almost surely
  3227. defines very low limits on these two, and your program might have problems
  3228. getting the memory it needs for its stack.
  3229. DJGPP v2.0 has a subtle bug in its startup code that is seen very rarely, and
  3230. that manifests itself by a program crashing with Page Fault or SIGSEGV.  If
  3231. enlarging the stack and the CWSDPMI heap size didn't help, try adding some
  3232. (e.g., 4KB) static data to your program and see if that helps.
  3233. File: djgppfaq.info,  Node: Command line,  Next: Converting,  Prev: Memory,  Up: Top
  3234. 16. Command-line Arguments Handling in DJGPP
  3235. ********************************************
  3236.   DJGPP handles command-line arguments differently from most DOS-based
  3237. compilers, to make it closer to Unix platforms (so that porting of Unix
  3238. programs will be easier).  This chapter answers some questions about this
  3239. aspect of DJGPP.
  3240. * Menu:
  3241. * Filename globbing::         Wildcard expansion under DJGPP
  3242. * Disable globbing::          You can disable globbing if you don't need it.
  3243. * Special chars::             How to pass arguments with special chars.
  3244. * Long commands::             DJGPP can pass very long command lines.
  3245. * How long::                  Look here to find out how long.
  3246. * Makefiles::                 Makefiles can disable long command lines.
  3247. File: djgppfaq.info,  Node: Filename globbing,  Next: Disable globbing,  Prev: Command line,  Up: Command line
  3248. 16.1 Filename wildcards expansion under DJGPP
  3249. =============================================
  3250. **Q*: Can I do filename globbing with DJGPP?*
  3251. **Q*: I call my program with an argument `x*y' and it complains about
  3252. something called `xyzzy'??...*
  3253. *A* :  The filename globbing in DJGPP is done by the start-up code, before
  3254. your `main' function is called.  Unlike other DOS-based compilers, where you
  3255. must link your program with a special object module if you want the program
  3256. to get expanded filenames, in DJGPP this is considered normal behavior and
  3257. performed by default on behalf of every DJGPP program.  The `x*y' above was
  3258. expanded to a file called `xyzzy' which was probably present in the current
  3259. working directory.  (If you don't want the default expansion, see *Note how
  3260. to disable globbing: Disable globbing.)
  3261. In DJGPP, filename globbing works like in Unix, which is more general than
  3262. the usual DOS wildcard expansion.  It understands the following constructs
  3263. with special meta-characters:
  3264.      any single character.
  3265.      zero or more arbitrary characters, including a dot `.'
  3266. `[aA_]'
  3267.      any one of characters `a', `A', or `_'.
  3268. `[a-d]'
  3269.      any one of characters `a', `b', `c', or `d'.
  3270. `[!a-z]'
  3271.      anything *but* a lowercase letter.
  3272. `...'
  3273.      all the subdirectories, recursively (VMS aficionados, rejoice!).
  3274. `.../*'
  3275.      all the files in all subdirectories, recursively.
  3276. Unlike DOS, the `*' and `?' meta-characters can appear *anywhere* in the
  3277. filename pattern, like in `[a-z]*[0-9].*pp.' You can also use `*' instead of
  3278. directories, like in `*/*/*.c', but *not* on drive letters (e.g., `[a-c]:/'
  3279. won't work).
  3280. Note that `*.*' only picks up files that actually have an extension.  This is
  3281. contrary to the usual DOS practice where it means *all* the files, with or
  3282. without extension.
  3283. An argument which cannot be expanded (no filenames matching that particular
  3284. pattern) will be passed to the program verbatim.  This is different from what
  3285. you might see under Unix, where some shells (like `csh') would say something
  3286. like "No match" and won't call your program at all.  DJGPP's behavior in this
  3287. case is like shells of the Bourne legacy (`sh', `ksh', and `bash').
  3288. File: djgppfaq.info,  Node: Disable globbing,  Next: Special chars,  Prev: Filename globbing,  Up: Command line
  3289. 16.2 How to disable filename wildcards expansion
  3290. ================================================
  3291. **Q*: OK, but I don't want my program to glob its arguments (they aren't
  3292. files at all, but they include characters like `*' and `?').  What should I
  3293. *A* :  You have these alternatives:
  3294.    * Surround your arguments with single or double quotes (this is what you
  3295.      would do under a Unix shell).
  3296.    * Disable globbing for your program by linking it with your custom version
  3297.      of the function with the special name `__crt0_glob_function' and make it
  3298.      always return a `NULL' pointer.  See the documentation of this function
  3299.      in the library reference.
  3300. File: djgppfaq.info,  Node: Special chars,  Next: Long commands,  Prev: Disable globbing,  Up: Command line
  3301. 16.3 How to pass command-line arguments with quotes or <@>
  3302. ==========================================================
  3303. **Q*: I have a file with a single quote in its name, but the quote seems to
  3304. be stripped away when I pass it to my program ...*
  3305. **Q*: How do I pass a command-line argument which contains double quotes? *
  3306. **Q*: How do I pass an argument which begins with the <@> character?*
  3307. *A* :  These special characters on the command-line arguments are handled by
  3308. the filename expansion ("globbing") code before they are passed to the `main'
  3309. function (*note description of filename expansion: Filename globbing.), and
  3310. the quote characters serve to protect the arguments from expansion.  You
  3311. should escape-protect the quote characters with a backslash in order for them
  3312. to be treated as literal characters.  For example, if you have a file called
  3313. `myfile.c'v', type it as `myfile.c\'v' when you call your program.  If you
  3314. have single quotes in your program arguments *and* you don't want those
  3315. arguments to be expanded, then surround them by double quotes, like this:
  3316. `"*.c\'v".'  The program will get the string `*.c'v' with the double quotes
  3317. stripped away.
  3318. Note that backslashes are only special if they are in front of a quote,
  3319. whitespace, or backslash (they also serve as DOS directory separators,
  3320. remember?).
  3321. The <@> character serves to signal a "response file" (*note the description
  3322. of response file method: Long commands.), so it's also special.  To pass an
  3323. argument whose first character is <@>, surround that argument with single or
  3324. double quotes, otherwise it will be taken as a name of a response file which
  3325. holds the actual command line.
  3326. File: djgppfaq.info,  Node: Long commands,  Next: How long,  Prev: Special chars,  Up: Command line
  3327. 16.4 How to pass command lines longer than 126 characters
  3328. =========================================================
  3329. **Q*: Can I invoke my program with a command line longer than the infamous
  3330. DOS 126-character limit?*
  3331. **Q*: I have a Makefile of Unix origin which contains some *very* long
  3332. command lines.  Will it work with DJGPP?*
  3333. *A* :  Yes and yes.  DJGPP supports several methods of passing command-line
  3334. arguments which allow it to work around the DOS 126-character limit.  These
  3335.    * The `!proxy' method.  If you invoke the program from within another
  3336.      DJGPP program (like Make or Gcc compilation driver), it gets the address
  3337.      of the memory block where the actual command line is stored.  The
  3338.      start-up code will detect this and use that info to retrieve the
  3339.      command-line arguments.
  3340.      This method is suitable only for invoking DJGPP programs from other DJGPP
  3341.      programs.  You don't have to do anything special to use this method, it
  3342.      is all done automagically for you by the library functions like
  3343.      `system', `spawnXX' and `execXX' on the parent program side, and by the
  3344.      start-up code on the child side.  (1) (*note Long commands-Footnotes::)
  3345.    * The response file method.  Any argument which starts with a <@>
  3346.      character (like in `myprog @file') will cause the named `file' to be
  3347.      read and its contents used as command-line arguments, like in many
  3348.      DOS-based compilers and linkers.  If you invoke your DJGPP program from
  3349.      the DOS command line, this would be the only method available for you to
  3350.      pass long command lines (like when calling `Gawk' or `Sed' without `-f'
  3351.      option).
  3352.      Note that this method makes <@> special when it is the first (or the
  3353.      only) character of a command-line argument, which should be
  3354.      escape-protected if you want to use it verbatim (*note how to pass the @
  3355.      character: Special chars.).
  3356. Of course, if the start-up code doesn't see any of the above methods, it will
  3357. use the command line by default.
  3358. File: djgppfaq.info,  Node: Long commands-Footnotes,  Up: Long commands
  3359. (1)  In case you wonder, the name `!proxy' comes from the the string which
  3360. identifies the use of this method: instead of getting the actual command
  3361. line, the program gets `!proxy' followed by the address of the actual command
  3362. line.
  3363. File: djgppfaq.info,  Node: How long,  Next: Makefiles,  Prev: Long commands,  Up: Command line
  3364. 16.5 What is the maximum length of command line under DJGPP
  3365. ===========================================================
  3366. **Q*: What is the longest command line I can pass to gcc when it is invoked
  3367. by `Make'?*
  3368. *A* :  The arguments are passed to DOS Exec call (Int 21h function 4Bh) via
  3369. the transfer buffer which is 16KB-long.  Apart of the command line, it is
  3370. also used to pass other info, such as the `!proxy' parameters and the copy of
  3371. the environment for the child program (let's say, less than 2000 bytes in
  3372. most cases, but your mileage may vary).  This leaves at least 13K bytes for
  3373. arguments (including a separating blank between any two arguments).  So
  3374. unless your arguments span more than 160 screen lines, you shouldn't worry.
  3375. However, if your environment is *very* large (some people need as much as 6KB
  3376. to accommodate for all the variables used by the various packages installed
  3377. on their machine), be sure to stub-edit the programs that spawn other
  3378. programs to larger transfer buffer, or else they could fail.
  3379. The above limit depends on the size of the transfer buffer, so check the size
  3380. of the value recorded in the stub header of the *parent program* before you
  3381. pass extremely long command lines to its children.  GCC is the first program
  3382. you should worry about, because the linker (`ld.exe') usually gets long
  3383. command lines from GCC (they include the list of all the object files and
  3384. libraries to be linked).
  3385. File: djgppfaq.info,  Node: Makefiles,  Prev: How long,  Up: Command line
  3386. 16.6 Why Make passes only 126 characters to programs?
  3387. =====================================================
  3388. **Q*: I use Make to compile with GCC, but GCC gets only the first 126
  3389. characters of its command line.  Didn't you just explain in so many words
  3390. that invoking a DJGPP program (GCC) from another DJGPP program (Make) can
  3391. safely pass up to 13K characters of command-line arguments using the `!proxy'
  3392. method?*
  3393. *A* :  Check your Makefile for `SHELL = command.com' statements, or for
  3394. commands which include pipe or redirection characters like `>', `|', etc.  If
  3395. Make sees any such statements, it will invoke `COMMAND.COM' to run GCC, and
  3396. `COMMAND.COM' can't pass more than 126 characters to GCC.  To work around,
  3397. comment-out the `SHELL=' line, and change your commands to work without
  3398. redirection/pipe characters.  One easy way to get rid of redirection
  3399. characters without losing their effect is to use the `redir' program which
  3400. comes with DJGPP.  For example, the following command:
  3401.        frobnicate foo.bar > myfile.tmp
  3402. can be re-written instead like this:
  3403.        redir -o myfile.tmp frobnicate foo.bar
  3404. File: djgppfaq.info,  Node: Converting,  Next: Low-level,  Prev: Command line,  Up: Top
  3405. 17. Converting DOS Programs/Libraries to DJGPP
  3406. **********************************************
  3407.   If you have a program or a library developed under some other DOS-based
  3408. compiler, which you want to port to DJGPP, read this chapter.
  3409. * Menu:
  3410. * Syntax::                  The (AT&T) syntax of Gas is different.
  3411. * Gas bugs::                Don't trust Gas!
  3412. * Converting ASM::          Automated conversion tool.
  3413. * ASM GPF::                 When converted code crashes.
  3414. * OBJ and LIB::             You can't use them with GCC.
  3415. * 16-bit code::             ...or can you?
  3416. * NEAR and FAR::            How to convert these to DJGPP.
  3417. File: djgppfaq.info,  Node: Syntax,  Next: Gas bugs,  Prev: Converting,  Up: Converting
  3418. 17.1 GCC/Gas won't accept valid assembly code ...
  3419. =================================================
  3420. **Q*: I have some code written in assembly which compiles under `MASM' and
  3421. `TASM', but GCC gives me a long list of error messages.*
  3422. *A* :  The GNU Assembler (`as.exe'), or `Gas' called by GCC accepts "AT&T"
  3423. syntax, which is different from "Intel" syntax.  Notable differences between
  3424. the two syntaxes are:
  3425.    * AT&T immediate operands are preceded by `$'; Intel immediate operands
  3426.      are undelimited (Intel `push 4' is AT&T `pushl $4').
  3427.    * AT&T register operands are preceded by `%'; Intel register operands are
  3428.      undelimited.  AT&T absolute (as opposed to PC-relative) `jump'/`call'
  3429.      operands are prefixed by `*'; they are undelimited in Intel syntax.
  3430.    * AT&T and Intel syntax use the opposite order for source and destination
  3431.      operands.  Intel `add eax, 4' is `addl $4, %eax' in AT&T syntax.
  3432.      The `source, dest' convention is maintained for compatibility with
  3433.      previous Unix assemblers, so that GCC won't care about the assembler with
  3434.      which it is configured, as some of GCC installations (on systems other
  3435.      than MS-DOS) don't use GNU Binutils.
  3436.    * In AT&T syntax, the size of memory operands is determined from the last
  3437.      character of the opcode name.  Opcode suffixes of `b', `w', and `l'
  3438.      specify byte (8-bit), word (16-bit), and long (32-bit) memory
  3439.      references.  Intel syntax accomplishes this by prefixing memory operands
  3440.      (*not* the opcodes themselves) with ``byte ptr'', ``word ptr'', and
  3441.      ``dword ptr'.'  Thus, Intel `mov al, byte ptr FOO' is `movb FOO, %al' in
  3442.      AT&T syntax.
  3443.    * Immediate form long jumps and calls are `lcall/ljmp $SECTION, $OFFSET'
  3444.      in AT&T syntax; the Intel syntax is `call/jmp far SECTION:OFFSET.'
  3445.      Also, the far return instruction is `lret $STACK-ADJUST' in AT&T syntax;
  3446.      Intel syntax is `ret far STACK-ADJUST.'
  3447.    * The AT&T assembler does not provide support for multiple-section (aka
  3448.      multi-segment) programs.  Unix style systems expect all programs to be
  3449.      single-section.
  3450.    * An Intel syntax indirect memory reference of the form
  3451.            SECTION:[BASE + INDEX*SCALE + DISP]
  3452.      is translated into the AT&T syntax
  3453.            SECTION:DISP(BASE, INDEX, SCALE)
  3454. Examples:
  3455.          *Intel:*  [ebp - 4]         *AT&T:*  -4(%ebp)
  3456.          *Intel:*  [foo + eax*4]     *AT&T:*  foo(,%eax,4)
  3457.          *Intel:*  [foo]             *AT&T:*  foo(,1)
  3458.          *Intel:*  gs:foo            *AT&T:*  %gs:foo
  3459. For a complete description of the differences, get and unzip the files named
  3460. `as.iN' (where `N' is a digit) from the bnu252b.zip, e.g.
  3461. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu252b.zip archive, then
  3462. see *Note i386-dependent features: (as)i386-Dependent.  If you don't read
  3463. this FAQ with an Info browser, type at the DOS prompt:
  3464.       info as machine i386
  3465. You will see a menu of `Gas' features specific to x86 architecture.
  3466. A guide is available which was written by Brennan Mr. Wacko Underwood
  3467. <brennan@mack.rt66.com>; it describes how to use inline assembly programming
  3468. with DJGPP and includes a tutorial on the AT&T assembly syntax.  Check out
  3469. the DJGPP inline assembly tutorial, at this URL:
  3470.      http://www.rt66.com/~brennan/djgpp/djgpp_asm.html
  3471. File: djgppfaq.info,  Node: Gas bugs,  Next: Converting ASM,  Prev: Syntax,  Up: Converting
  3472. 17.2 Double-check code produced by Gas
  3473. ======================================
  3474. **Q*: My assembly code gets corrupted by `Gas'!*
  3475. *A* :  When writing assembly code, you should remember *to not trust Gas!*
  3476. You should always check that it does what you expect it to do.  GNU Assembler
  3477. can currently be trusted only when it assembles code produced by GCC.  All
  3478. other code--yours--is subject to the introduction of subtle errors.  To be
  3479. sure, use a debugger to check the code (even `objdump' from GNU Binutils
  3480. doesn't always treat segment overrides correctly).  The following lists some
  3481. guidelines for safer machine-language programming with `Gas':
  3482.   a. Use explicit sizing.  E.g., use `movl' instead of `mov', even if you're
  3483.      sure the arguments are 32-bit wide.  The fact that you use byte
  3484.      registers doesn't seem to matter with `Gas.'
  3485.   b. Write code segment overrides as `.byte' constants, not as e.g.  `%cs:.'
  3486.      According to Charles Sandmann <sandmann@clio.rice.edu>, `Gas' uses the
  3487.      current phase of the moon in deciding whether to ignore your prefixes.
  3488.      So unless you know *exactly* what the phase of the moon is at the moment
  3489.      of assembly, use `.byte' constants.
  3490.   c. Make sure the operands match the instructions.  Don't assume that if they
  3491.      don't, you'll get an error message from the assembler.
  3492. File: djgppfaq.info,  Node: Converting ASM,  Next: ASM GPF,  Prev: Gas bugs,  Up: Converting
  3493. 17.3 Converting Intel ASM syntax to AT&T syntax
  3494. ===============================================
  3495. **Q*: Where can I find an automated conversion tool to convert my
  3496. `Intel'-style assembly code into a code acceptable by `Gas'?*
  3497. *A* :  A `Sed' script which should do most of the conversion was posted to
  3498. the DJGPP news group in the past.  You can find it in the DJGPP archives, at
  3499. this URL:
  3500.      http://www.delorie.com/djgpp/mail-archives/djgpp/1995/06/06/05:48:34
  3501. A conversion program called `TA2AS' which can convert TASM assembly source to
  3502. the AT&T format, can be found on the Oulu repository and on the DJGPP server,
  3503. e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/ta2asv08.zip and on the Oulu
  3504. repository, e.g. ftp://x2ftp.oulu.fi/pub/msdos/programming/convert/ta2as.zip.
  3505. `TA2AS' was written by Jan Oonk <jan@stack.urc.tue.nl>.
  3506. Alternatively, here is what you can do to convert your code:
  3507.    * For a small number of relatively short files, consider converting them
  3508.      with a smart editor (like Emacs or its work-alikes).
  3509.    * Obtain a copy of Microsoft MASM 6.11. It has a `-coff' option to
  3510.      generate object code in COFF format which can be submitted to GCC, so you
  3511.      can compile your original source.  You can also use the `LIB32'
  3512.      librarian from Microsoft C8 to convert object files to COFF by putting
  3513.      them into a `.lib' library, then extracting them as COFF files.  (1)
  3514.      (*note Converting ASM-Footnotes::)
  3515.    * Use a disassembler to disassemble the object code, then convert it to
  3516.      the AT&T format either by hand or using `TA2AS'.  One place to look for
  3517.      such a disassembler is on SimTel mirrors, e.g.
  3518.      ftp://ftp.simtel.net/pub/simtelnet/msdos/disasm/.
  3519. Keep in mind that syntax is only one of the aspects of converting code
  3520. written for DOS to DJGPP.  You should also make sure your code doesn't
  3521. violate any of the rules for protected-mode programming (*note next question:
  3522. ASM GPF.).
  3523. File: djgppfaq.info,  Node: Converting ASM-Footnotes,  Up: Converting ASM
  3524. (1)  If you use MASM or LIB32, please post your experiences to
  3525. comp.os.msdos.djgpp news group, so that I can make the above instructions
  3526. less vague.
  3527. File: djgppfaq.info,  Node: ASM GPF,  Next: OBJ and LIB,  Prev: Converting ASM,  Up: Converting
  3528. 17.4 Converted code GP Faults!
  3529. ==============================
  3530. **Q*: OK, I've succeeded in converting and compiling my assembly-language
  3531. program, but when I run it, I get "Segmentation Violation" and "General
  3532. Protection Fault".  This program works when compiled with MASM, so how can
  3533. this be?*
  3534. *A* :  In DJGPP, your program runs in *protected mode*.  There are certain
  3535. things you can't do in protected-mode programs (that's why it is called
  3536. protected mode).  This issue is too complex to describe here, so only a few
  3537. of the more important aspects will be briefly mentioned.  If you are serious
  3538. about writing assembly language protected-mode code, or have a large body of
  3539. existing code to convert to protected mode, you should read any of the
  3540. available books about protected-mode programming with 80x86 processors.
  3541. Here is a short list of some of the techniques found in many real-mode
  3542. programs, which will trigger protection violation or erratic behavior in
  3543. protected mode:
  3544.    * Loading arbitrary values into segment registers, then using them to
  3545.      reference code or data.
  3546.    * Referencing code with data segment register, or vice versa.
  3547.    * Assuming certain locations (like BIOS area or video memory) will be found
  3548.      at certain absolute addresses.
  3549.    * Calling DOS or BIOS services with `INT NN' instruction.
  3550. File: djgppfaq.info,  Node: OBJ and LIB,  Next: 16-bit code,  Prev: ASM GPF,  Up: Converting
  3551. 17.5 I want to use a `.obj' or `.lib' code with DJGPP
  3552. =====================================================
  3553. **Q*: I have a set of useful functions in a `.obj' format, but no source
  3554. code.  Can I use them with my DJGPP program?*
  3555. **Q*: I have this `ACMELUXE.LIB' library of functions which I want to use.
  3556. I've extracted all the `.obj' files, but when I try to link them with my
  3557. program, GCC complains: "File format not recognized".  Can't I use these
  3558. object files?*
  3559. **Q*: I've got a bunch of `.obj' files I want to use.  I've ran AR to make a
  3560. GCC-style `.a' object library, but got an error message from GCC saying
  3561. "couldn't read symbols: No symbols".  How can I link them with my code?*
  3562. *A* : Sorry, you probably can't.  The GNU linker called by GCC doesn't
  3563. understand the format of `.obj' files which other DOS-based
  3564. compilers/assemblers emit.  Unless you can get the source of those functions,
  3565. convert it to protected-mode, flat-address model code and compile them with
  3566. GCC, you most probably won't be able to use them.  (1) (*note OBJ and
  3567. LIB-Footnotes::)
  3568. Lately, an automated conversion tool called `OBJ2COFF' was written by the
  3569. SPiRiT team, which can be used to convert `.obj' object files and `.lib'
  3570. libraries to `COFF' format, provided that the original `.obj' files have been
  3571. written for flat-address memory model.  (You can also try using LIB32
  3572. librarian from Microsoft C8 to convert object files to COFF.)  The main
  3573. problem, of course, is that most such object files were written for real-mode
  3574. programs in memory models other than flat, and without extensive
  3575. modifications would crash your program anyway... (*Note previous question:
  3576. ASM GPF.)
  3577. `OBJ2COFF' is available from the Oulu repository, e.g.
  3578. ftp://x2ftp.oulu.fi/pub/msdos/programming/convert/o2cv10.arj and from DJ
  3579. Delorie's ftp server, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/o2cv06.arj.
  3580. If you have any problems with it or questions about it, send them to its
  3581. author, Rico <mb002@hi.ft.hse.nl> or to George van Venrooij
  3582. <george@il.ft.hse.nl>.
  3583. Another conversion tool you might try is `EMXAOUT' from the `emx/gcc'
  3584. package.  It also requires the code to be written for the flat-address memory
  3585. model and will reportedly complain if you feed it with code written for
  3586. segmented memory models.  `EMXAOUT' is available from the SciTech Software
  3587. FTP site, e.g. ftp://ftp.scitechsoft.com/devel/emxaout1.zip.  If you need,
  3588. you should be able to compile it with DJGPP; however, a precompiled binary is
  3589. available in the above archive.  Or you can get `EMXAOUT' from the EMX
  3590. archives, e.g. ftp://ftp-os2.nmsu.edu/os2/unix/emx09b/emxrt.zip and the RSX
  3591. extender (for running `EMXAOUT' under DPMI) from the RSX archives, e.g.
  3592. ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc/rsx503rt.zip.
  3593. File: djgppfaq.info,  Node: OBJ and LIB-Footnotes,  Up: OBJ and LIB
  3594. (1)  Note that mixing object files from different compilers usually won't
  3595. work, even if they both are in the `.obj' format.
  3596. File: djgppfaq.info,  Node: 16-bit code,  Next: NEAR and FAR,  Prev: OBJ and LIB,  Up: Converting
  3597. 17.6 I *must* use my 16-bit code with DJGPP!!
  3598. =============================================
  3599. **Q*: If that's how it is, then I would have to give up using DJGPP.  I
  3600. simply cannot live without these `.obj' files.  Are you *really* sure there
  3601. is nothing I can do??*
  3602. *A* :  If you need your old code *that* badly, then there might be a way,
  3603. albeit a cumbersome one.  You can write a 16-bit, real-mode program and link
  3604. it with your precious functions you can't live without.  Have this program
  3605. spawn a DJGPP-compiled program and make the two communicate with each other
  3606. via a buffer allocated in low memory, or via command-line parameters passed
  3607. to the 32-bit program by the `spawnXX' function call.  You can also call
  3608. 16-bit functions directly with the library function called
  3609. `__dpmi_simulate_real_mode_procedure_retf', provided the 16-bit program
  3610. passes the CS:IP values of these functions to the 32-bit program.  You can
  3611. even put your 16-bit code as binary instructions into a buffer allocated in
  3612. low memory and call it with `__dpmi_simulate_real_mode_procedure_retf' (but
  3613. if you can do that, you can probably also disassemble the code into a source
  3614. form and submit it to `Gas').
  3615. *Now* will you consider sticking with DJGPP?  *Please??...*
  3616. File: djgppfaq.info,  Node: NEAR and FAR,  Prev: 16-bit code,  Up: Converting
  3617. 17.7 What should I do with those "near" and "far" declarations?
  3618. ===============================================================
  3619. **Q*: I have this program that I need to port to DJGPP, but it is full of
  3620. pointers and functions declared with the "near" and "far" keywords which GCC
  3621. doesn't grok.  What shall I do?*
  3622. **Q*: A program written for a 16-bit compiler uses the MK_FP or _MK_FP macro,
  3623. but DJGPP doesn't seem to have it.  How should I port it?*
  3624. *A* :  In DJGPP you use a flat address space with no segmentation, so you
  3625. don't need far pointers in the sense they are used in 16-bit code.  Just
  3626. define away those keywords and you will be fine:
  3627.        #define far
  3628.        #define near
  3629.        #define huge
  3630.        #define _far
  3631.        #define _near
  3632.        #define _huge
  3633. Alternatively, you could add suitable `-D' switches to the GCC command line,
  3634. like this:
  3635.        gcc -Dfar -Dnear -Dhuge -c myprog.c
  3636. Macros that create far pointers from the segment and offset (usually called
  3637. `MK_FP' or `_MK_FP') are mostly used in 16-bit code to access certain
  3638. absolute addresses on memory-mapped peripheral devices, like the video RAM.
  3639. These chores are done differently in DJGPP; the details are described in
  3640. *Note accessing absolute addresses: Xfer, below.  You will need to rewrite
  3641. the code that uses these macros, so don't bother writing a replacement for
  3642. the macro itself.
  3643. Macros that extract the segment and the offset from a far pointer (called
  3644. `FP_SEG' and `FP_OFF') are required in 16-bit code to pass addresses in
  3645. registers when calling real-mode DOS or BIOS services, like functions of
  3646. interrupt 21h.  See *Note How to call real-mode interrupt functions: Pointer
  3647. segment, which describes how that should be done in DJGPP; here, too, you
  3648. won't need to port the above macros.
  3649. File: djgppfaq.info,  Node: Low-level,  Next: Legalese,  Prev: Converting,  Up: Top
  3650. 18. Low-level DOS/BIOS and Hardware-oriented Programming
  3651. ********************************************************
  3652.   This chapter sheds some light on a few aspects of writing DJGPP programs
  3653. which interact with hardware or use interrupts.
  3654. * Menu:
  3655. * int86::                 It doesn't always work.
  3656. * Pointer segment::       Some interrupts require it, but how do you get it?
  3657. * Zero SP::               If you don't, your program crashes.
  3658. * Xfer::                  Moving data to and from conventional memory.
  3659. * 20 bits::               You should mask off the upper 12 bits when unused.
  3660. * Fat DS::                Fast direct access to memory-mapped devices.
  3661. * Above 1MB::             Interact with memory-mapped devices above 1MB.
  3662. * RMCB::                  How to let DOS/BIOS call your code.
  3663. * Hardware interrupts::   How to hook HW interrupts from DJGPP.
  3664. * _go32 vs __dpmi::       Which functions should you use?
  3665. * HW Int pitfalls::       Does your machine wedge?  Here are some reasons.
  3666. * Ports::                 Reading and writing I/O ports in DJGPP.
  3667. * Inline Asm::            How to write inline assembly with GCC.
  3668. File: djgppfaq.info,  Node: int86,  Next: Pointer segment,  Prev: Low-level,  Up: Low-level
  3669. 18.1 Got "Unsupported INT 0xNN" calling `int86'
  3670. ===============================================
  3671. **Q*: Why does my program crash with "Unsupported DOS request 0xNN" or
  3672. "Unsupported INT 0xNN" when I call `int86' or `intdos' functions to invoke a
  3673. software interrupt?*
  3674. *A* :  Calling real-mode DOS or BIOS services from protected-mode programs
  3675. requires a switch to real mode, so the `int86' family of functions in the
  3676. DJGPP library should reissue the INT instruction after the mode switch.
  3677. However, some services require pointers to memory buffers.  Real-mode
  3678. DOS/BIOS functions can only access buffers in conventional memory, so `int86'
  3679. has to move data between your program and low memory to transparently support
  3680. these services.  But this means it should know about all these services to
  3681. perform these chores correctly, because each service has its own layout and
  3682. size of the buffer(s).  While `int86' supports many of these services, it
  3683. doesn't support all of them.  The supported functions are listed in the
  3684. library reference.  *Note int86 library reference: (libc.inf)int86.  For
  3685. those it doesn't support, you will have to call the `__dpmi_int' library
  3686. function instead.  It is also documented in the library reference, *Note
  3687. __dpmi_int: (libc.inf)__dpmi_int.  `__dpmi_int' requires that you set up all
  3688. the data as required by the service you are calling, including moving the
  3689. data to and from low memory (*Note how to use buffers with DOS/BIOS services:
  3690. Pointer segment, below).
  3691. File: djgppfaq.info,  Node: Pointer segment,  Next: Zero SP,  Prev: int86,  Up: Low-level
  3692. 18.2 How to use buffers with DOS/BIOS services
  3693. ==============================================
  3694. **Q*: I want to call a DOS/BIOS function which requires a pointer to a buffer
  3695. in, e.g. `ES:DI' (or any other) register pair.  How do I get the segment to
  3696. put into the `ES' register?*
  3697. *A* :  If you use `int86x' or `intdosx' for a DOS or BIOS function supported
  3698. by them, then just put the address of your buffer into the register which
  3699. expects the offset (`regs.x.di') and forget about the segment.  These
  3700. functions are processed specially by the library, which will take care of the
  3701. rest.
  3702. If you call `__dpmi_int', then you must put into that register pair an
  3703. address of some buffer in *conventional* memory (in the first 1 MByte).  If
  3704. the size of that buffer doesn't have to be larger than the size of transfer
  3705. buffer used by DJGPP (16KB by default), then the easiest way is to use the
  3706. transfer buffer.  (Library functions don't assume its contents to be
  3707. preserved across function calls, so you can use it freely.) That buffer is
  3708. used for all DOS/BIOS services supported by DJGPP, and it resides in
  3709. conventional memory.  DJGPP makes the address and the size of the transfer
  3710. buffer available for you in the `_go32_info_block' external variable, which
  3711. is documented the library reference.  Check the size of the buffer (usually,
  3712. 16K bytes, but it can be made as small as 2KB), and if it suits you, use its
  3713. linear address this way:
  3714.      dpmi_regs.x.di =
  3715.       _go32_info_block.linear_address_of_transfer_buffer & 0x0f;
  3716.      dpmi_regs.x.es =
  3717.       (_go32_info_block.linear_address_of_transfer_buffer >> 4) & 0xffff;
  3718. For your convenience, the header file `<go32.h>' defines a macro `__tb' which
  3719. is an alias for `_go32_info_block.linear_address_of_transfer_buffer.'
  3720. If the size of the transfer buffer isn't enough, you will have to allocate
  3721. your own buffer in conventional memory with a call to the
  3722. `__dpmi_allocate_dos_memory' library function.  It returns to you the segment
  3723. of the allocated block (the offset is zero).  If you only need a small number
  3724. of such buffers which can be allocated once, then you don't have to worry
  3725. about freeing them: they will be freed by DOS when your program calls `exit.'
  3726. For bullet-proof code, you should test the size of the transfer buffer at
  3727. runtime and act accordingly.  This is because its size can be changed by the
  3728. `STUBEDIT' program without your knowledge.
  3729. File: djgppfaq.info,  Node: Zero SP,  Next: Xfer,  Prev: Pointer segment,  Up: Low-level
  3730. 18.3 How to call software interrupt functions
  3731. =============================================
  3732. **Q*: My program crashes/doesn't do what it should when I call
  3733. `__dpmi_simulate_real_mode_interrupt.'*
  3734. *A* :  You should zero out some of the fields of the `__dpmi_regs' structure
  3735. before you call that function.  Random values in these fields can cause your
  3736. program to behave erratically.  The fields in point are `SS', `SP' and
  3737. `FLAGS.'  When `SS' and `SP' are zeroed, the DPMI host will provide a stack
  3738. for the interrupt handler.  This stack is locked and is 4KB-long for any
  3739. handling done in protected mode (such as real-mode callbacks), and at least
  3740. 512 bytes in size for interrupts reflected into real mode.  This is usually
  3741. enough, but sometimes you'll need to use your own, larger stack, e.g., if you
  3742. expect interrupts to nest, or if your handler needs a lot of stack space.
  3743. (1) (*note Zero SP-Footnotes::)  In these cases you should point `SS' and
  3744. `SP' to a larger buffer which is in conventional memory (possibly part of the
  3745. transfer buffer).
  3746. If `SS:SP' isn't zero, it will be used as the address of the stack you want
  3747. to be used by the interrupt handler, so if it points to a random location,
  3748. your program will crash.  A non-zero `FLAGS' field can also make the
  3749. processor do all kinds of weird things (e.g., imagine that the single-step or
  3750. the debug bit is set!).
  3751. If you don't have any reason to set `SS:SP' to your stack, it's easier to
  3752. call the `__dpmi_int' library function, which zeroes out the stack pointer
  3753. and the `FLAGS' fields for you (and also doesn't force you to type long
  3754. function names!).
  3755. File: djgppfaq.info,  Node: Zero SP-Footnotes,  Up: Zero SP
  3756. (1)  The DPMI spec indicates that you should *not* use the default stack if
  3757. your procedure/interrupt handler uses more that 60 bytes, or 1/8 of the total
  3758. stack space available by default.
  3759. File: djgppfaq.info,  Node: Xfer,  Next: 20 bits,  Prev: Zero SP,  Up: Low-level
  3760. 18.4 How to move data between your program and conventional memory?
  3761. ===================================================================
  3762. **Q*: How can I move data between my program and the transfer buffer?*
  3763. **Q*: How do I access my peripheral card which is memory-mapped to an address
  3764. between 640K and 1M?*
  3765. **Q*: How can I read or change a value of one of the variables in the BIOS
  3766. data area?*
  3767. **Q*: How can I peek at an address whose far pointer I get from an INT 21h
  3768. call?*
  3769. *A* :  Depending on your specific needs, you can use one of three methods:
  3770.    * If you want to access a byte, a 16-bit word, or a 32-bit double word, use
  3771.      the "far pointer" functions declared on the the `<sys/farptr.h>' header
  3772.      file.  You should convert any real-mode far pointer segment:offset pair
  3773.      into a "linear address" (i.e., segment*16 + offset), and use the
  3774.      `_dos_ds' macro to get the selector which allows access to conventional
  3775.      memory, like this:
  3776.            unsigned char value = _farpeekb(_dos_ds, segment*16 + offset);
  3777.      Use `_farpeekw' to peek at 16-bit shorts and `_farpeekl' to peek at
  3778.      32-bit longs.  If you need to access several (non-contiguous) values in
  3779.      a loop, use the corresponding `_farnspeekX' functions which allow you to
  3780.      set the selector only once, as opposed to passing it with every call
  3781.      (but be sure the loop doesn't call any function that itself sets the
  3782.      selector; see the library reference for more details).
  3783.      There is a corresponding set of `_farpokeX' and `_farnspokeX' functions
  3784.      to poke (change the values of) such memory locations.
  3785.      These functions have an advantage of emitting inline assembly code when
  3786.      you compile with optimizations, so they are very fast.  See the library
  3787.      reference Info file for further details about these functions.
  3788.    * If you need to access more than 4 contiguous bytes, use `dosmemget' and
  3789.      `dosmemput' library functions.  They also require you to convert the
  3790.      segment:offset pair into a linear address, but they don't need the
  3791.      conventional memory selector, as they can only be used to access the
  3792.      conventional memory.
  3793.      Note that some memory-mapped peripheral devices might require 16-bit word
  3794.      accesses to work properly, so if `dosmemXXX' yields garbled results, try
  3795.      `dosmemXXXw' or "farptr" functions.
  3796.    * For moving buffers larger than a few tens of bytes, it's best to use
  3797.      `movedata' library function.  It requires that you pass selector and
  3798.      offset for both the conventional memory address and for the buffer in
  3799.      your program's address space.  Use the `_my_ds' function to get the
  3800.      selector of any variable in your program, and use the address of the
  3801.      variable (cast to an `int') as its "offset" or linear address.
  3802.      `movedata' is faster because it moves by 32-bit longs, but be careful
  3803.      with its use when moving data to and from peripheral cards: some of them
  3804.      only support 8- or 16-bit wide data path, so moving data 4 bytes at a
  3805.      time won't gain you much, and might even get you in trouble with some
  3806.      buggy BIOSes.  The functions `movedatab' and `movedataw' are provided
  3807.      for moving by bytes and by 16-bit words, respectively.
  3808.    * For the fastest access to memory outside your usual flat address space,
  3809.      you might consider using the "nearptr" functions declared on the
  3810.      `<sys/nearptr.h>' header; see the library reference for more details.
  3811.      Also see the description of how to get the *Note fastest direct access
  3812.      to peripheral devices: Fat DS, below.
  3813. File: djgppfaq.info,  Node: 20 bits,  Next: Fat DS,  Prev: Xfer,  Up: Low-level
  3814. 18.5 Conventional-memory addresses use only 20 bits
  3815. ===================================================
  3816. **Q*: I call `movedata' to pass data between my program and the transfer
  3817. buffer, but get bogus values or General Protection Fault.*
  3818. *A* :  Valid conventional-memory addresses are only 20 bit-wide.  However,
  3819. the value stored in the variable
  3820. `_go32_info_block.linear_address_of_transfer_buffer' (or its alias, `__tb')
  3821. is not guaranteed to have the higher 12 bits zeroed, and `movedata' doesn't
  3822. mask those high bits, because it can also be used to move data between 2
  3823. protected-memory locations.  Be sure to mask off the high 12 bits of the
  3824. value returned by various `..._linear_address_...' fields in DJGPP
  3825. structures, whenever that address references a conventional memory location,
  3826. before you call *any* of the functions from the `movedataX' family, the
  3827. "farptr" or the "nearptr" functions.
  3828. File: djgppfaq.info,  Node: Fat DS,  Next: Above 1MB,  Prev: 20 bits,  Up: Low-level
  3829. 18.6 Fast access to memory-mapped devices or absolute addresses
  3830. ===============================================================
  3831. **Q*: The "farptr" functions are too slow for my application which *MUST*
  3832. have direct access to a memory-mapped device under DPMI.  How can I have this
  3833. in DJGPP?  My entire optimized graphics library is at stake if I can't! :(*
  3834. *A* :  The following so-called Fat DS method was suggested by Junaid A.
  3835. Walker <junaid@barney.eng.monash.edu.au> (he also posted a program which uses
  3836. this technique to access the video RAM; you can look it up by searching the
  3837. mailing list archives).  But first, a word of warning: the method I'm about
  3838. to describe effectively disables memory protection, and so might do all kinds
  3839. of damage if used by a program with a wild pointer.  Or, as Stephen Turnbull
  3840. <turnbull@shako.sk.tsukuba.ac.jp> has put it:
  3841.      *Surgeon General's WARNING*:  The description below uses the "Fat DS
  3842.      hack", a steroid derivative which gives your program great strength, a
  3843.      thick neck, baldness, and is known to be closely linked with the
  3844.      Alzheimer's disease.
  3845. Having said that, here is the trick: you change the limit of the segment
  3846. descriptor stored in `DS' to `0xffffffff' (i.e., -1), using function 8 of the
  3847. DPMI interrupt 31h.  After that, you have access to all the memory which is
  3848. currently mapped in.  You then use the 32-bit wrap-around in the linear
  3849. address space to access memory at, say, linear address 0xa0000 (which belongs
  3850. to the VGA), or any other address on your memory-mapped device.
  3851. You should know up front that this trick won't work with every DPMI host.
  3852. Linux's DOSEmu and Win/NT won't allow you to set such a huge limit on the
  3853. memory segment, because these operating systems take memory protection
  3854. seriously; in these cases `__djgpp_nearptr_enable' will return zero--a sign
  3855. of a failure.  CWSDPMI, QDPMI, Win 3.x and Win 9x all allow this technique
  3856. (OS/2 Warp seems to allow it too, at least as of version 8.200), but some
  3857. events break this scheme even for those DPMI hosts which will allow it.  A
  3858. call to `malloc' or any other library function which calls `sbrk' might
  3859. sometimes change the base address of the `DS' selector and break this method
  3860. unless the base address is recomputed after `sbrk' call.  (The "nearptr"
  3861. functions support this recomputation by providing you with the
  3862. `__djgpp_conventional_base' variable, but it is your responsibility to use
  3863. it.)  The same change happens when you call `system', and as a result of some
  3864. other events external to the executing code thread, like multitasking or
  3865. debugger execution.
  3866. You should also know that the `__djgpp_nearptr_enable' function currently
  3867. doesn't verify that the limit was properly set.  So if the DPMI server would
  3868. fail the call *silently*, the function won't detect it and will not return a
  3869. failure indication (but we don't know about any such DPMI server).
  3870. If you are aware of these limitations, and don't need your code to run under
  3871. all DPMI hosts, it might be the fix to your problems.
  3872. Confused about how exactly should you go about using this technique in your
  3873. program?  Look at the docs of the "nearptr" functions, *Note
  3874. __djgpp_nearptr_enable: (libc.inf)__djgpp_nearptr_enable.
  3875. Another possibility is to use the DPMI function `0x508' that can map any
  3876. range of physical memory addresses into a block that you allocate.  Note that
  3877. this is a DPMI 1.0 functionality which is *not* supported by most DPMI 0.9
  3878. hosts (`CWSDPMI' does support it).  There is a helper function
  3879. `__djgpp_map_physical_memory' in the DJGPP C library that you can use to call
  3880. these services.
  3881. File: djgppfaq.info,  Node: Above 1MB,  Next: RMCB,  Prev: Fat DS,  Up: Low-level
  3882. 18.7 Accessing absolute address above 1MB
  3883. =========================================
  3884. **Q*: How can I access memory-mapped peripheral devices (or any other
  3885. absolute address) above 1 MByte mark?*
  3886. *A* :  Use the `__dpmi_physical_address_mapping' library function.  It
  3887. returns a linear address which can be used to access a given absolute
  3888. physical address.  You can then use the functions from <sys/farptr.h> to
  3889. access that linear address.  If you prefer to create the mapping yourself,
  3890. these are the DPMI calls that you will have to use:
  3891.    - allocate an LDT descriptor (Int 31h/AX=0);
  3892.    - map selector to physical address (Int 31h/AX=0800h);
  3893.    - lock linear address (Int 31h/AX=0600h);
  3894.    - set segment base address (Int 31h/AX=7);
  3895.    - set segment limit (Int 31h/AX=8).
  3896. All of these DPMI calls have `__dpmi__XXX' wrappers in the DJGPP library.
  3897. File: djgppfaq.info,  Node: RMCB,  Next: Hardware interrupts,  Prev: Above 1MB,  Up: Low-level
  3898. 18.8 How to make DOS/BIOS call your function
  3899. ============================================
  3900. **Q*: How can I make any real-mode service call my function?  E.g., the mouse
  3901. driver has a provision (function 0Ch) to call a user-defined handler when
  3902. certain events occur, which expects a far pointer to my function in the
  3903. `ES:DX' register pair.*
  3904. *A* :  Those services expect a real-mode function, so you should wrap your
  3905. protected-mode function with a real-mode stub.  To this end, call either the
  3906. `_go32_dpmi_allocate_real_mode_callback_retf' or the
  3907. `_go32_dpmi_allocate_real_mode_callback_iret' library function, as required
  3908. by the real-mode service you want to hook, and pass the `segment' and
  3909. `offset' fields it returns to the service you want (in the above example, Int
  3910. 33h function 0Ch) by calling `__dpmi_int.'  See the docs in the library
  3911. reference Info file for further details about allocating wrapper function.
  3912. File: djgppfaq.info,  Node: Hardware interrupts,  Next: _go32 vs __dpmi,  Prev: RMCB,  Up: Low-level
  3913. 18.9 How to hook hardware interrupts
  3914. ====================================
  3915. **Q*: How do I register my DJGPP function as a hardware interrupt handler?*
  3916. *A* :  The optimal set-up depends on the interrupt frequency and on the
  3917. amount of processing it requires.  Therefore, only some basic considerations
  3918. and techniques are listed below.  What combination of these is best for your
  3919. application is up to you to decide.
  3920. First, some background.  Hardware interrupts can occur when the processor is
  3921. either in real mode (like when your program calls some DOS service) or in
  3922. protected mode.  When your program runs under a DPMI host, hardware
  3923. interrupts are always passed to protected mode first, and only if unhandled
  3924. are they reflected to real mode.  Therefore, in DPMI mode you can get away
  3925. with installing only a protected-mode handler.  However, if the interrupts
  3926. happen at a high frequency (say, more than 10 KHz), then the overhead of the
  3927. interrupt reflection from real to protected mode might be too painful, and
  3928. you might consider installing a real-mode interrupt handler in addition to
  3929. the protected-mode one.  If you do, you must hook the PM interrupt first,
  3930. then the RM one (because hooking the PM interrupt modifies the RM one). Also,
  3931. you should know that some DPMI hosts don't allow you to hook the RM interrupt
  3932. (CWSDPMI does); the only way to be sure is to try.
  3933. To install a protected-mode interrupt handler, you do this:
  3934.    * In general, your handler should be written in assembly to be
  3935.      bullet-proof.  It should lock all the memory (code, data and stack) it
  3936.      touches during interrupt processing (this is virtually impossible in C),
  3937.      explicitly issue the `STI' instruction before `IRET' and perform all the
  3938.      other chores described in the DPMI spec (*note DOS Protected Mode
  3939.      Interface Specification: DPMI Spec.).  To install assembly handler, you
  3940.      should do this:
  3941.         - Call `__dpmi_get_protected_mode_interrupt_vector' and save the
  3942.           structure it returns (to restore the previous handler address
  3943.           before your program exits).
  3944.         - Lock all the memory your handler touches with a series of calls to
  3945.           `__dpmi_lock_linear_region.'
  3946.         - Finally, call `__dpmi_set_protected_mode_interrupt_vector' passing
  3947.           it the pointer to a `__dpmi_paddr' structure filled with `_my_cs'
  3948.           in the `selector' field and the address of your function in the
  3949.           `offset32' field.
  3950.    * If your handler function is written in C, you should generally call the
  3951.      `_go32_dpmi_XXX' functions instead of the bare-bones API wrappers whose
  3952.      names start with `__dpmi_.'  Specifically:
  3953.         - Call `_go32_dpmi_get_protected_mode_interrupt_vector.'  This
  3954.           function puts the selector and offset of the specified interrupt
  3955.           vector into the `pm_selector' and `pm_offset' fields of the
  3956.           structure pointed to by its second argument.  This data should be
  3957.           saved and later passed to
  3958.           `_go32_dpmi_get_protected_mode_interrupt_vector' to restore the
  3959.           vector on exit.
  3960.         - Call `_go32_dpmi_allocate_iret_wrapper,' passing it the address of
  3961.           your functions in the `pm_offset' field and the value of `_my_cs'
  3962.           in the `pm_selector' field.  The `pm_offset' field will get
  3963.           replaced with the address of the wrapper function which is a small
  3964.           assembler function that handles everything an interrupt handler
  3965.           should do on entry and before exit (and what the code GCC generates
  3966.           for an ordinary C function doesn't include); the effect is similar
  3967.           to using interrupt or `_interrupt' keyword in some DOS-based
  3968.           compilers.
  3969.         - If you want your handler to chain to the previous handler, call
  3970.           `_go32_dpmi_chain_protected_mode_interrupt_vector.'  This will set
  3971.           up a wrapper function which, when called, will call your handler,
  3972.           then jump to the previous handler after your handler returns.  Put
  3973.           the address of your handler into the `pm_offset' field and the
  3974.           value of `_my_cs' into the `pm_selector' field of the
  3975.           `_go32_dpmi_seginfo' structure and pass a pointer to it to this
  3976.           function.
  3977.         - You then call `_go32_dpmi_set_protected_mode_interrupt_vector' with
  3978.           the address of the `_go32_dpmi_seginfo' structure you got either
  3979.           from `_go32_dpmi_allocate_iret_wrapper' or from
  3980.           `_go32_dpmi_chain_protected_mode_interrupt_vector.'
  3981.      The problem with writing handlers in C as above is that the wrappers'
  3982.      code and data aren't locked, and in practice you can't lock all of
  3983.      memory the handler itself uses, either.  Thus, this approach is
  3984.      generally unsuitable for production-quality software and should be used
  3985.      only when the program is known not to page (i.e., only the physical
  3986.      memory is used).  You might consider disabling virtual memory to make
  3987.      sure your program doesn't page.  To accomplish this, either set the
  3988.      `_CRT0_FLAG_LOCK_MEMORY' bit in the `_crt0_startup_flags' variable, or
  3989.      use `CWSDPR0' or `PMODE/DJ' as your DPMI host.  In fact, using one of
  3990.      these methods is the recommended way of debugging the first versions of
  3991.      a program that hooks hardware interrupts; only after you are sure that
  3992.      your basic machinery works should you move to testing it in a setup when
  3993.      paging might happen.
  3994.      Note that `_CRT0_FLAG_LOCK_MEMORY' is only recommended for small
  3995.      programs that run on a machine where enough physical memory is always
  3996.      available, because the startup code currently doesn't test if memory is
  3997.      indeed locked, and you can end up with unlocked, or partially unlocked
  3998.      memory, which will crash your program.
  3999. To install a real-mode interrupt handler, you do this:
  4000.    * Call `__dpmi_get_real_mode_interrupt_vector' and save the structure it
  4001.      returns (to restore the previous handler address before your program
  4002.      exits).
  4003.    * Allocate some conventional memory with `__dpmi_allocate_dos_memory' and
  4004.      put the code of your handler there with the `dosmemput' function.  (You
  4005.      could also call one of the functions which allocate a real-mode
  4006.      call-back, but these will cause a mode switch on every interrupt, which
  4007.      you want to avoid; otherwise there is no point in installing a real-mode
  4008.      handler, right?)
  4009.    * Put the address which `__dpmi_allocate_dos_memory' returned into a
  4010.      `__dpmi_raddr' structure (the lower 4 bits into `offset16' field, the
  4011.      rest into `segment' field), then call
  4012.      `__dpmi_set_real_mode_interrupt_vector.'
  4013. For examples of installing and using hardware interrupt handlers, see the
  4014. sample code written by Bill Currie <bill_currie@MAIL.TAIT.CO.NZ>, the Sound
  4015. Blaster interrupt-driven functions, the `mkkbd' package, and the `libhw'
  4016. library, described under *Note sample DJGPP packages: Samples.  Alaric B.
  4017. Williams <@abwillms.demon.co.uk> has written a tutorial on DJGPP interrupt
  4018. handling, at this URL:
  4019.      http://www.abwillms.demon.co.uk/prog/djints.txt
  4020. File: djgppfaq.info,  Node: _go32 vs __dpmi,  Next: HW Int pitfalls,  Prev: Hardware interrupts,  Up: Low-level
  4021. 18.10 Should I use _go32_XXX or __dpmi_YYY functions?
  4022. =====================================================
  4023. **Q*: In v1.x I was used to the `_go32_...' functions, but now comes v2 which
  4024. also has `__dpmi_...' functions.  Are there any differences between these two
  4025. varieties?*
  4026. **Q*: Do I need to convert my old v1.x code to use the new `__dpmi_...'
  4027. functions?*
  4028. *A* :  These two groups of functions have different functionality, so don't
  4029. just substitute the new ones for the older ones, because it usually won't
  4030. work!  The new `__dpmi_...' functions are just bare-bones wrappers of the
  4031. DPMI API calls (*note DPMI Specification: DPMI Spec.), generally unsuitable
  4032. for use with handlers written in C, whereas the old `_go32_...' functions are
  4033. intelligent helper functions which only make sense if your interrupt handlers
  4034. are C functions.  The problem with the `_go32_...' functions is that they
  4035. don't lock all the code and data they (and your handlers) use, so they can
  4036. crash on memory-tight machines and thus aren't suitable for
  4037. production-quality code.  But they are certainly useful in the initial stages
  4038. of writing and debugging code that hooks hardware interrupts, and for
  4039. migrating existing v1.x code to v2.  Some of the old names were just
  4040. `#define'd' to the new names where the functionality is identical.
  4041. The bottom line is that it shouldn't be necessary to convert your code for it
  4042. to work at least as well as it did in v1.x; but if you want it to be more
  4043. stable, you should rewrite your handlers in assembly and use the new
  4044. `__dpmi_...' functions (*note How to install a hardware interrupt handler:
  4045. Hardware interrupts.).
  4046. File: djgppfaq.info,  Node: HW Int pitfalls,  Next: Ports,  Prev: _go32 vs __dpmi,  Up: Low-level
  4047. 18.11 Hardware interrupt hooking has its subtleties ...
  4048. =======================================================
  4049. **Q*: I did all the above, but my program occasionally still hangs...*
  4050. *A* :  Hooking hardware interrupts in DJGPP (and in protected mode in
  4051. general) has a few subtle aspects.  In general, hardware interrupt handling
  4052. in DJGPP v2.0 is rock solid *if you play by the rules*.  Unfortunately, the
  4053. rules are a bit tricky.
  4054. One cause of your problems might be that your interrupt handler or some
  4055. memory location it uses get paged out because of the virtual memory
  4056. mechanism, or because your program spawned a child program.  In that case,
  4057. the interrupt might cause a call to a non-existent service routine, with the
  4058. obvious results.  You should lock all the memory pages that your handler
  4059. accesses by calling the `__dpmi_lock_linear_region' library function.  This
  4060. also means in practice that you should write your handler in assembly, as
  4061. described in *Note how to set an interrupt handler: Hardware interrupts,
  4062. above.  You can disable virtual memory, or put `_CRT0_FLAG_LOCK_MEMORY' into
  4063. `_crt0_startup_flags' to make sure nothing is paged out (but then your
  4064. program might not have enough memory to run, unless you run on
  4065. memory-abundant systems).
  4066. Another problem might be that the hardware peripheral you use generates a lot
  4067. of interrupts.  Due to specifics of hardware interrupts handling in protected
  4068. mode, there is a substantial overhead involved with reflection of interrupts
  4069. between real and protected modes.  For instance, on a 486DX/33 this
  4070. reflection might consume up to 3000 clocks; on a 386SX/16, even a 1KHz clock
  4071. might eat up 1/2 of available cycles.  If your hardware fires too many
  4072. interrupts, your CPU might not be able to keep up.  In that case, consider
  4073. reducing the interrupt frequency, or move some of the processing done inside
  4074. the interrupt handler to some other place.  Use a ring 0 DPMI server such as
  4075. `CWSDPR0' or `PMODE/DJ' which don't swap interrupt stacks--this will reduce
  4076. the overhead of the interrupt reflection to some degree.  If your handler is
  4077. written in C, write it in assembly and make sure it doesn't chain.  If that
  4078. doesn't help, install a real-mode handler.
  4079. Some losing memory managers, notably EMM386, were reported to induce a high
  4080. interrupt handling overhead.  In one case, a user reported an increase in the
  4081. interrupt rate from 2 KHz to 6 KHz after uninstalling EMM386.
  4082. Still another possibility is that you use a non-default `sbrk' algorithm in
  4083. your program (check if the header file `crt0.h' is included anywhere in the
  4084. program, and if so, if the `_CRT0_FLAG_UNIX_SBRK' bit in the
  4085. `_crt0_startup_flags' variable is set by the program.  If it is, then a
  4086. hardware interrupt which happens at the wrong time could crash your machine,
  4087. especially if you run under Windows 3.x.
  4088. You should also keep in mind that the DPMI server can decide to handle some
  4089. of the interrupts itself and not pass them to your program, although this is
  4090. rare.  For example, Win95 won't pass the Ctrl-Alt-Del combination to your
  4091. keyboard interrupt handler, but will rather act on it itself; QDPMI sometimes
  4092. processes Ctrl-C presses so that your program never sees them, etc.
  4093. Sometimes, but not always, you can change some configuration option to make
  4094. some keys get to your handler (e.g., the Alt-TAB setting on the Win3.x `.PIF'
  4095. file).
  4096. If the above still doesn't explain your problem, then post your code on
  4097. comp.os.msdos.djgpp news group or the djgpp mailing list <djgpp@delorie.com>,
  4098. tell there how it fails and somebody will usually have a solution or a
  4099. work-around for you.
  4100. File: djgppfaq.info,  Node: Ports,  Next: Inline Asm,  Prev: HW Int pitfalls,  Up: Low-level
  4101. 18.12 How to read and write ports
  4102. =================================
  4103. **Q*: I need to read from and write to PC ports, and I'm accustomed to using
  4104. the `inp' and `outp' functions.  But I hear they aren't available in DJGPP?*
  4105. *A* :  They are in v2.x.  Just  `#include <pc.h>'  and you get their
  4106. prototypes.  The functions themselves are in the default library.  Note that
  4107. there are also size-specific versions for byte- word- and dword-long access
  4108. (e.g., `inportl' for reading a 32-bit dword), as well as functions to
  4109. read/write sequences of bytes and words, like `inportsb' and `outportsw';
  4110. these are DJGPP-specific.
  4111. File: djgppfaq.info,  Node: Inline Asm,  Prev: Ports,  Up: Low-level
  4112. 18.13 Inline Assembly code with GCC
  4113. ===================================
  4114. **Q*: I am used to writing inline assembly with Borland C, but can't figure
  4115. out the way to do it with GCC...*
  4116. **Q*: How can I reference C variables from my inline assembly code?*
  4117. *A* :  GCC has extensive inline assembly facilities.  They allow you to
  4118. specify everything other compilers let you (like the registers where GCC will
  4119. put specific results), but in a way that doesn't disable compiler
  4120. optimizations of the code that includes inline assembly.  Because of this
  4121. flexibility, the syntax of the inline assembly code is very different from
  4122. the other DOS-based compilers.  The GCC on-line docs describe these
  4123. facilities in detail; to read the relevant sections, type this from the DOS
  4124. prompt:
  4125.        info gcc "C Extensions" "Extended Asm"
  4126. (Note the quotes: they are important.)  You will, of course, need that the
  4127. stand-alone info reader be installed on your system for the above command to
  4128. work.  If it is not already installed, get the file `txi360b.zip' from the
  4129. DJGPP distribution and install it.
  4130. If you read this FAQ via WWW, you can also read about the GCC inline assembly
  4131. extensions with your Web browser, at this URL:
  4132.      http://www.delorie.com/gnu/docs/gcc/gcc_86.html#SEC89
  4133. File: djgppfaq.info,  Node: Legalese,  Next: Help,  Prev: Low-level,  Up: Top
  4134. 19. Legal Aspects
  4135. *****************
  4136.   This chapter answers some questions about various legal aspects of writing
  4137. programs with DJGPP.
  4138. * Menu:
  4139. * Applications::    Legal restrictions of applications written with DJGPP.
  4140. * Redistribution::  Legal aspects of redistributing DJGPP itself.
  4141. File: djgppfaq.info,  Node: Applications,  Next: Redistribution,  Prev: Legalese,  Up: Legalese
  4142. 19.1 Legal (un)restrictions on DJGPP applications
  4143. =================================================
  4144. **Q*: Can you explain in plain English the legal restrictions of distributing
  4145. programs compiled with DJGPP?*
  4146. **Q*: Can I write commercial programs with DJGPP?*
  4147. *A* :  In most cases, you don't have to worry about any legal restrictions
  4148. when you compile your programs with DJGPP.  Using the GNU C/C++ compiler
  4149. doesn't make your programs subject to *any* restrictions.  The C library
  4150. which comes with DJGPP is *free*, which means you are free to use it in any
  4151. way you like (but please observe *Note basic rules of courtesy:
  4152. Redistribution.)  So, if you write C programs, you have absolutely nothing to
  4153. worry about.
  4154. The basic C++ `iostream' class library (`libiostr.a') and the Standard
  4155. Template Library (`libstdcx.a') which come with DJGPP allow you to use them
  4156. binary-wise (i.e., without changing library sources) in your C++ programs
  4157. *without restrictions*, unless you compile your programs with a compiler
  4158. other than Gcc (which won't happen if you work with DJGPP).  Only the library
  4159. of additional C++ classes (`libgpp.a') requires that you provide your
  4160. customers with source or object code of the application, so they could relink
  4161. the application with future or modified versions of the C++ library.  (If you
  4162. intend to distribute commercial programs linked with the `libgpp.a' library,
  4163. you are strongly advised to read the GNU Library General Public License which
  4164. comes with the library, for rigorous definition of its terms.)
  4165. Note that `libiostr.a' library doesn't place your program under GPL or LGPL,
  4166. so if you only use C++ classes included in that library, make your
  4167. compilations use `libiostr.a' instead of `libgpp.a.' (That's the only reason
  4168. for having `libiostream.a' as a separate file, because `libgpp.a' includes
  4169. everything `libiostream.a' does, so you never need both of them.)
  4170. Two GNU packages, `Flex' and `Bison', are also special in that using them to
  4171. produce your programs doesn't place your programs under GPL or LGPL.  In
  4172. other words, lexers produced by `Flex' and parsers produced by `Bison' do
  4173. *not* imply GPL/LGPL.
  4174. If you *do* use in your program any of the FSF sources that fall under
  4175. GPL/LGPL (like some of the GCC's sources, or the GNU `getopt' or `regex'
  4176. packages which come with many GNU programs), then you must comply with the
  4177. terms of GNU licenses when distributing your programs; in this case your
  4178. entire application becomes GPL.  If that is unacceptable to you, consider
  4179. using the versions of `regex' and `getopt' from the DJGPP C library (which is
  4180. free).
  4181. You may ship any of the utilities developed specifically for DJGPP (e.g., the
  4182. floating-point emulator or the CWSDPMI DPMI host) *as distributed by DJ
  4183. Delorie* with your program with no other requirement besides telling your
  4184. customers how to get DJGPP for themselves.
  4185. Note that the above says nothing about the legal aspects of contributed
  4186. packages, like `GRX' and others; you will need to read their docs to find out.
  4187. File: djgppfaq.info,  Node: Redistribution,  Prev: Applications,  Up: Legalese
  4188. 19.2 Legal restrictions of DJGPP utilities and libraries
  4189. ========================================================
  4190. **Q*: Can I redistribute djgpp, and if so, how?*
  4191. **Q*: I run a business that sells shareware for distribution costs.  Can I
  4192. include djgpp on my CD-ROM?*
  4193. **Q*: I want to include djgpp in a product that happens to need a compiler
  4194. provided with it.  Can I do this?*
  4195. **Q*: Is DJGPP GNU software?*
  4196. **Q*: Is DJGPP public domain software?*
  4197. **Q*: Is DJGPP shareware?*
  4198. *A* :  DJGPP is *not* public domain, neither is it shareware (you *don't*
  4199. have to pay a license fee to use DJGPP).  Parts of DJGPP (the compiler and
  4200. some of the development tools) *are* GNU software, so you must comply with
  4201. GNU GPL if you distribute those parts (usually, you won't need to distribute
  4202. them, because they are freely available to everyone).  A small part of the C
  4203. library is taken from the Berkeley BSD sources, and is therefore in public
  4204. domain.  Other parts of DJGPP, which include most of the C library, the free
  4205. DPMI host CWSDPMI, and some of the utilities, are copyrighted, but in a way
  4206. that allows you to use them freely and without restrictions.
  4207. When you redistribute DJGPP itself (as opposed to your programs compiled with
  4208. DJGPP), you must comply to the conditions applicable to whatever you
  4209. distribute.  The parts which are in public domain are, of course, freely
  4210. distributable.  Other parts of DJGPP fall under the DJGPP copyright which
  4211. allows you to redistribute everything provided you follow these rules:
  4212.    * You must redistribute DJGPP as a whole, with all its parts, including
  4213.      the sources to utilities and libraries that are part of DJGPP, unless
  4214.      other arrangements are first made with DJ Delorie <dj@delorie.com>.
  4215.    * Please make a good faith effort to stay up to date with the latest DJGPP
  4216.      versions, so people don't get old versions with bugs that are long ago
  4217.      solved, or, worse still, versions that are no longer supported.
  4218.    * You must call it *DJGPP* and nothing else.
  4219.    * You may *not* take credit for it, and you must *not* remove any notices
  4220.      in DJGPP that give credit to those who worked on it.
  4221.    * You must tell the recipient how to get the latest version off the
  4222.      Internet, or at least how to find out what the latest version is.
  4223.      DJ Delorie gets a lot of questions from people who got old versions from
  4224.      vendors, and don't realize that they're way out of date.
  4225.    * Distributing CWSDPMI with shareware or commercial programs requires
  4226.      notification of its author Charles Sandmann <sandmann@clio.rice.edu> by
  4227.      mail or acknowledged e-mail.
  4228. In addition, it would be a courtesy to inform DJ Delorie <dj@delorie.com>
  4229. that you are including DJGPP in your product, in case this information is
  4230. obsolete.  A token sample of your distribution would be nice also.
  4231. File: djgppfaq.info,  Node: Help,  Next: v2,  Prev: Legalese,  Up: Top
  4232. 20. Getting Help
  4233. ****************
  4234.   This chapter tells you how to get answers to questions you didn't find in
  4235. this FAQ.
  4236. * Menu:
  4237. * DJGPP isn't GNU::             Do *not* post to GNU News groups.
  4238. * Mailing list::                How to post to DJGPP mailing list.
  4239. * Subscribing::                 You can see every posted article.
  4240. * Unsubscribing::               When it's too much to read...
  4241. * Silent list::                 Is the list alive?
  4242. * Duplicates::                  If you get duplicate messages.
  4243. * Newsgroup::                   We prefer you use it instead of the
  4244.                                   mailing list.
  4245. File: djgppfaq.info,  Node: DJGPP isn't GNU,  Next: Mailing list,  Prev: Help,  Up: Help
  4246. 20.1 Don't post DJGPP-specific problems to GNU News groups
  4247. ==========================================================
  4248. **Q*: I post my problem to the "help-gcc" News group, but don't get any
  4249. answers.*
  4250. *A* :  Is your problem likely to be special to the DJGPP port or to the DOS
  4251. environment?  If so, don't post to GNU Usenet groups, but to the
  4252. comp.os.msdos.djgpp news group or to the DJGPP mailing list
  4253. <djgpp@delorie.com>.  People who read GNU News groups usually neither know
  4254. nor care about DOS-specific problems.  Post there only if the problem seems
  4255. to be a generic one in one of the FSF utilities.  For most problems, this can
  4256. be deduced only after either tracing a problem in the source code or testing
  4257. it on some non-DOS platform.  As a general rule, always post to the DJGPP
  4258. group first.
  4259. File: djgppfaq.info,  Node: Mailing list,  Next: Subscribing,  Prev: DJGPP isn't GNU,  Up: Help
  4260. 20.2 How to post to the mailing list
  4261. ====================================
  4262. **Q*: How do I post to the DJGPP mailing list?*
  4263. *A* :  Send mail to the list address <djgpp@delorie.com> as if it were a
  4264. person.  Please use the mailing list only if you cannot access the DJGPP news
  4265. group, because reflecting the mail to and from the mailing lists incurs
  4266. additional load on the DJGPP server.
  4267. File: djgppfaq.info,  Node: Subscribing,  Next: Unsubscribing,  Prev: Mailing list,  Up: Help
  4268. 20.3 How to become a subscriber to the mailing list
  4269. ===================================================
  4270. **Q*: How do I subscribe to the DJGPP mailing list?*
  4271. *A* :  Send mail to the list server <listserv@delorie.com> (NOT to djgpp@!!),
  4272. leave the subject line empty and in the body write:
  4273.       subscribe <your e-mail address> djgpp
  4274. If you only want to receive announcements of new versions and ported
  4275. software, but don't want to see any other DJGPP mail traffic, subscribe to
  4276. the `djgpp-announce' by sending message to the list server
  4277. <listserv@delorie.com> which says so:
  4278.       subscribe <your e-mail address> djgpp-announce
  4279. The announcements which go to `djgpp-announce' get reflected to `djgpp', so
  4280. you don't have to subscribe to both these lists.
  4281. The DJGPP mailing list is available in the daily and weekly digest forms.  To
  4282. subscribe to one of these, send this one-line message to the above list
  4283. server:
  4284.       subscribe <your e-mail address> djgpp-digest-daily
  4285.       subscribe <your e-mail address> djgpp-digest-weekly
  4286. Note that some mailers reject messages with too large size, so you might have
  4287. trouble with the weekly digest.  If you subscribe to it and don't get the
  4288. digest, try the daily one instead, or switch to another mail software.
  4289. You can also subscribe to DJGPP-related mailing lists through DJ Delorie's
  4290. WWW server, at this URL:
  4291.      http://www.delorie.com/mailing-lists/subscribe.html
  4292. Note that you don't have to subscribe to the djgpp mailing list if you don't
  4293. want to get all the traffic in your mailbox (typically, about 30 messages per
  4294. day).  You can ask questions on the list even if you are not a subscriber,
  4295. because people usually answer both to your e-mail address and to the list
  4296. (well, actually, the mailer program does it automatically and most people
  4297. don't bother to change that).  If you want to be sure the mail gets to you
  4298. directly, say in your message that you don't subscribe to the list, and ask
  4299. people to answer directly.
  4300. If you have a Usenet feed, consider reading the comp.os.msdos.djgpp news
  4301. group instead, so that the load on DJ's list server will get lower.  There is
  4302. also a possibility of reading the news group (but not posting to it) through
  4303. the Mercury Gopher server at Michigan State University,
  4304. gopher://gopher.msu.edu:3441/chronological%20comp.os.msdos.djgpp
  4305. File: djgppfaq.info,  Node: Unsubscribing,  Next: Silent list,  Prev: Subscribing,  Up: Help
  4306. 20.4 How to unsubscribe from the mailing list
  4307. =============================================
  4308. **Q*: Whew!  There's too much traffic on the djgpp mailing list (at least the
  4309. SysAdmin glaring over my shoulder thinks so... ;-).  How do I unsubscribe
  4310. myself?*
  4311. **Q*: I've been trying for days to unsubscribe from the djgpp mailing list.
  4312. What am I doing wrong?*
  4313. *A* :  You should be sending your unsubscribe messages to the list server
  4314. <listserv@delorie.com> *(not djgpp@delorie.com!),* with the contents being
  4315. just this:
  4316.       unsubscribe <your e-mail address> djgpp
  4317. When you unsubscribe, that stops *new* messages from being sent to you.
  4318. Messages that are already in the mail queues of various mail programs between
  4319. the DJGPP list server and the machine where you receive your mail--cannot be
  4320. stopped.  Therefore, allow some time before you decide that your unsubscribe
  4321. message didn't work.  In extreme cases, when one of the machines that are
  4322. forwarding mail to you is down, you can get the messages upto 5 days after
  4323. you've unsubscribed.
  4324. If you think you have waited enough and the messages still keep coming, write
  4325. to listserv administrator <djgpp-request@delorie.com> and ask him to help you.
  4326. You can also unsubscribe yourself from any of the DJGPP-related mailing lists
  4327. through DJ Delorie's WWW server, at this URL:
  4328.      http://www.delorie.com/djgpp/mailing-lists/subscribe.html
  4329. Recently, DJ has added a mail archive browser to his Web site.  With this
  4330. tool, you can list and read the messages by year, month and day, as well as
  4331. search the last few days for something you might have missed.  This service
  4332. is available via World-Wide Web, at this URL:
  4333.      http://www.delorie.com/djgpp/mail-archives/browse.cgi
  4334. File: djgppfaq.info,  Node: Silent list,  Next: Duplicates,  Prev: Unsubscribing,  Up: Help
  4335. 20.5 If you don't see any message from the list ...
  4336. ===================================================
  4337. **Q*: I don't get any messages from the DJGPP list for several days.  Is the
  4338. list alive?*
  4339. *A* : Try sending a message to the list and see if you get it back.  If not,
  4340. it is possible that your name was inadvertently taken off the list.  This is
  4341. known to happen sometimes (don't ask me how).  Also, if your address
  4342. consistently fails (like "user unknown" or "unknown host"), DJ Delorie
  4343. removes that address from the list, but cannot send a message to this effect,
  4344. for obvious reasons.  You can check if you are subscribed to any of the
  4345. DJGPP-related mailing lists through DJ Delorie's WWW server, at this URL:
  4346.      http://www.delorie.com/djgpp/mailing-lists/subscribe.html
  4347. If this tells you you're not, re-subscribe yourself by sending the above
  4348. subscription message to listserv <listserv@delorie.com>, or via DJ's server,
  4349. at this URL:
  4350.      http://www.delorie.com/djgpp/mailing-lists/subscribe.html
  4351. When in doubt, re-subscribe anyway (it hurts neither you, nor the list
  4352. server).
  4353. If you subscribe to the weekly digest, then the problem might be that your
  4354. mailer rejects the huge message size.  Try the daily digest, or switch to
  4355. another mailer, and see if that helps.
  4356. File: djgppfaq.info,  Node: Duplicates,  Next: Newsgroup,  Prev: Silent list,  Up: Help
  4357. 20.6 Why do I get every message more than once?
  4358. ===============================================
  4359. **Q*: Why am I getting 2 and often more copies of the same message?  Don't
  4360. you people think I can get the idea at the first reading??*
  4361. *A* :  First, check the headers to make sure that all of the duplicate
  4362. messages have their `To:' header addressed to the DJGPP list, not to your
  4363. direct e-mail address.  Often, when people reply to your post, you get the
  4364. direct message, and a `Cc:' (the "carbon copy") one via djgpp list server.
  4365. This is normal behavior.
  4366. If indeed you get more than one copy of a message addressed to the list, it
  4367. is possible that you have added yourself to the list several times.  (This
  4368. could happen if your site supports a mail exploder which re-mails DJGPP to
  4369. you, and you have also subscribed yourself directly.)  One way to check this
  4370. would be to unsubscribe and see if you keep getting mail.  Another way is to
  4371. check your subscription through DJ's server, at this URL:
  4372.      http://www.delorie.com/djgpp/mailing-lists/subscribe.html
  4373. Look out for multiple subscriptions, possibly under different
  4374. names/addresses.  You could also write to DJ Delorie <dj@delorie.com>, and
  4375. ask him to investigate.
  4376. Another thing to do, especially if you think it's not your fault, is to write
  4377. to a user named POSTMASTER at the address of each of the machines whose names
  4378. you find in the `Received:' headers of the bouncing messages (these are
  4379. people responsible for the operation of the mail software at their sites) and
  4380. ask them politely to help.
  4381. Many times this kind of problem is caused by excessive load on the list
  4382. server, so everybody who can please switch to reading the comp.os.msdos.djgpp
  4383. news group and unsubscribe from the list.
  4384. File: djgppfaq.info,  Node: Newsgroup,  Prev: Duplicates,  Up: Help
  4385. 20.7 DJGPP now has a news group!
  4386. ================================
  4387. **Q*: With so much daily traffic (about 30 messages a day), isn't it high
  4388. time to create a Usenet News group?*
  4389. *A* :  Beginning June 1st, 1995, DJGPP *has* its News group!  It is called
  4390. *comp.os.msdos.djgpp*, and it is two-way gated to the venerable DJGPP mailing
  4391. list.  This means messages posted to either the mailing list or the news
  4392. group will appear on both (once, let's hope ;-); you can read either one and
  4393. post to either one, and everyone eventually sees everything.  The entire
  4394. traffic ends up in the mail archives on the DJ's Web server within 24 hours,
  4395. and is available for searching, at this URL:
  4396.      http://www.delorie.com/djgpp/mail-archives/
  4397. If you have a Usenet feed, now is the time to consider unsubscribing from the
  4398. mailing list and switch to reading the news group instead, so that the load
  4399. on the list server will get lower.
  4400. File: djgppfaq.info,  Node: v2,  Next: Miscellany,  Prev: Help,  Up: Top
  4401. 21. Version 2.0 vs v1.x
  4402. ***********************
  4403.   This chapter is for those who are used to working with DJGPP v1.x and want to
  4404. know more about v2.0 while they consider switching.
  4405. * Menu:
  4406. * New and improved::            What's new in v2.0?
  4407. * Environment::                 How v2.0 environment is different from v1.
  4408. File: djgppfaq.info,  Node: New and improved,  Next: Environment,  Prev: v2,  Up: v2
  4409. 21.1 New features in DJGPP v2.0
  4410. ===============================
  4411. **Q*: What exciting new features will I find in v2.0 as opposed to v1.x?*
  4412. *A* :  DJGPP v2.0 is a DPMI-only environment, and it includes a free DPMI
  4413. host for those who don't have another DPMI provider installed.  In addition,
  4414. v2.0 features the following major improvements upon v1.1x:
  4415.    * much faster extender (the free DPMI host) and library functions;
  4416.    * very low memory footprint of the DPMI host below 640KB;
  4417.    * the DPMI server is loaded only once: no more problems with spawning child
  4418.      programs (e.g., almost unlimited recursive Make's);
  4419.    * ANSI- and POSIX-compliant libraries and header files, which should make
  4420.      porting Unix programs a lot easier;
  4421.    * support for signals;
  4422.    * 387 emulation under DPMI;
  4423.    * graphics which works in *any* setup, including under Windows;
  4424.    * fixes of many bugs in hardware interrupts' and mixed-mode programming
  4425.      support;
  4426.    * ability to build all of DJGPP without commercial products (like Turbo C
  4427.      required to compile go32 in v1.x);
  4428. If you want to help in further v2 development, check out the list of features
  4429. which have yet to be done and volunteer to implement some of them.
  4430. File: djgppfaq.info,  Node: Environment,  Prev: New and improved,  Up: v2
  4431. 21.2 DJGPP environment in v2.0
  4432. ==============================
  4433. **Q*: There's been this talk about v2 and about `go32' going away in that
  4434. version, but I'm confused on what the new setup will be.  Could you clarify
  4435. the details of this change?*
  4436. *A* :  In v1.x of DJGPP, the `go32' extender was responsible for the
  4437. following:
  4438.    * Loading and running the application in protected mode.
  4439.    * Managing protected-mode and virtual memory.
  4440.    * "Extending DOS" so that protected-mode programs could issue calls to
  4441.      real-mode DOS and BIOS services and still run.  (This is mostly done by
  4442.      switching to real mode and reissuing the interrupt, but some services
  4443.      require special handling by the extender.)
  4444.    * Handling of hardware interrupts which happen while the CPU is in
  4445.      protected mode.
  4446.    * Loading 387 emulator (if required).
  4447.    * Loading the graphics driver and working with VGA bank-switching to create
  4448.      an illusion of a linear video memory.
  4449.    * Command-line and wild-card expansion in a Unix-like fashion.
  4450. In v2.x, most of these functions are done by a DPMI host, which is a
  4451. memory-resident software required to run protected-mode programs under
  4452. MS-DOS.  There are a few commercial DPMI hosts (like Quarterdeck's `QDPMI',
  4453. Qualitas `386Max', MS-Windows 3.x and Win95, OS/2, even Linux), but DJGPP v2
  4454. comes with a free DPMI host called `CWSDPMI' for those who don't have one
  4455. already.  Loading the application into protected-mode memory (a function done
  4456. in v1.x by `go32') is handled by a 2KB-long real-mode stub which runs at
  4457. start-up, before the application's `main' functions is called (the stub will
  4458. also load `CWSDPMI' if no other DPMI host is detected).  All the other custom
  4459. code required to process BIOS- and DOS-related calls from protected-mode is
  4460. now built into the library functions which your program calls, so there is no
  4461. need for a special extender, because the application just issues DPMI calls
  4462. serviced by the DPMI host.
  4463. `CWSDPMI' can be loaded as a TSR, even loaded `HIGH' into the HMA/UMB, which
  4464. will make applications load much faster.
  4465. File: djgppfaq.info,  Node: Miscellany,  Next: About,  Prev: v2,  Up: Top
  4466. 22. Miscellany
  4467. **************
  4468.   This chapter is a hodgepodge of questions which don't belong to any of the
  4469. other chapters.
  4470. * Menu:
  4471. * Changing::            How to change any DJGPP package?
  4472. * Samples::             Where to find sample/ported code for DJGPP?
  4473. * Symlinks::            Yes, DJGPP allows them (well, almost...)
  4474. * DPMI Spec::           Where to look for DPMI specifications.
  4475. * WWW::                 The DJGPP Web site.
  4476. * Upload::              Where to upload your DJGPP packages.
  4477. * Cross-DJGPP::         You can use DJGPP for cross-development.
  4478. * 0xfe+0x20::           Is this a bug?
  4479. * Struct size::         What is the size of a struct under DJGPP?
  4480. * Struct packing::      C++ compiler doesn't pack structs.
  4481. * Int 24h::             Catching those "Abort, Retry" messages.
  4482. * go32-v2::             What is go32-v2 for?
  4483. * DXE::                 What are those `.dxe' files?
  4484. * LFN::                 LFN support has some subtle bugs.
  4485. * Missing separator::   What does Make mean by that?
  4486. * Zoneinfo::            What's in that *zoneinfo/* directory?
  4487. * FAQ format::          How to convert this FAQ to other formats.
  4488. File: djgppfaq.info,  Node: Changing,  Next: Samples,  Prev: Miscellany,  Up: Miscellany
  4489. 22.1 How to change a DJGPP package?
  4490. ===================================
  4491. **Q*: I want to change cc1.  How do I do this?*
  4492. **Q*: How do I fix a bug/add a feature to one of the DJGPP programs?*
  4493. *A* :  First, get the sources.  These are called `*s.zip' in the DJGPP
  4494. distribution.  The C Library sources are in `djlsr200.zip'.  Some sources are
  4495. too big, and might be split into multiple zips, all of which must be unzipped
  4496. to get a complete source distribution, like this:
  4497. `gcc263s1.zip'
  4498. `gcc263s2.zip'
  4499. `gcc263s3.zip'
  4500. `gcc263s4.zip'
  4501. `gcc263s5.zip'
  4502. `gcc263s6.zip'
  4503. All sources are shipped in ready-to-build form.  Any diffs that come with the
  4504. source distribution, like the files in the `diffs/' directory, have already
  4505. been applied.
  4506. Next, try to build the program without changing it.  Some packages will have
  4507. a `CONFIGUR.BAT' file; if so, run it first.  If there is a `MAKE.BAT' file,
  4508. run it; if not, look for a file named `MAKEFILE.DJ' or `MAKEFILE.DJG';
  4509. sometimes these will be in a subdirectory called `dos/', or `msdos/', or
  4510. `pc/.'  If there is such a file, then type, e.g., `make -f makefile.djg', if
  4511. not, just say `make' and see what happens.  (The reason for an apparent lack
  4512. of a standard here is that different packages were ported to DJGPP by
  4513. different people, as best as they saw fit.)  After you've successfully built
  4514. the program, make your fixes and build the program the same way you did
  4515. before.
  4516. Note that generally you must have the GNU `Make' program to build these
  4517. programs (get the file mak373b.zip, e.g.
  4518. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/mak373b.zip), and some
  4519. makefiles require that you install additional utilities, like Sed (get
  4520. sed118b.zip, e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/sed118b.zip).
  4521. Sometimes the makefiles won't even run under `COMMAND.COM' (they require a
  4522. smarter shell).  In that case, either get a better shell, convert the
  4523. makefile to be runnable by `COMMAND', or do the required steps manually.  If
  4524. the Makefile is too complex for you and you can't figure out what are the
  4525. necessary commands, invoke make with `-n' switch and see what it would have
  4526. done.
  4527. If your machine lacks floating-point hardware (like a 386 without a 387, or a
  4528. 486SX), then you should know that current versions of GNU Sed and GNU Make
  4529. issue floating point instructions, so you will have to make provisions for
  4530. loading an emulator, see above, *Note FP Emulation: Emulation.
  4531. If you think that you found a bug in one of the programs or libraries written
  4532. for DJGPP (e.g. the C library, CWSDPMI, symify, etc.) be sure to check the
  4533. list of known bugs, at this URL:
  4534.      http://www.delorie.com/djgpp/doc/kb/kb_7.html#SEC4
  4535. If your bug is not there, you can later submit it to the bug-tracking system,
  4536. at this URL:
  4537.      http://www.delorie.com/djgpp/bugs/
  4538. Before you submit a bug report, please make every effort to verify that your
  4539. bug is not caused by problems in your DJGPP installation.  Reports such as
  4540. "All DJGPP programs crash" or "I cannot compile any program" are clearly not
  4541. bugs, because these things work for many hundreds of DJGPP users every day.
  4542. If you can investigate the cause of the bug and find a solution that makes it
  4543. go away, submit a bug report with all the details.  If you cannot find the
  4544. cause(s), I suggest posting your problem description to the news group and
  4545. asking people to verify that it is indeed a bug, before you submit a bug
  4546. report.
  4547. File: djgppfaq.info,  Node: Samples,  Next: Symlinks,  Prev: Changing,  Up: Miscellany
  4548. 22.2 Where to find sample DJGPP code or a package ported to DJGPP?
  4549. ==================================================================
  4550. **Q*: Where can I find an example of XXXX / a package doing YYYY ?*
  4551. *A* :  Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp> has compiled a list
  4552. of publicly available packages related to DJGPP, based on the DJGPP mailing
  4553. list traffic.  The list is still under construction (Steve says that many
  4554. pointers have not been followed up to get host and directory references
  4555. right), so it must be taken with a grain of salt.  Check out Steve's list, at
  4556. this URL:
  4557.      http://turnbull.sk.tsukuba.ac.jp/public-ftp/djgpp/doc/documentation.list.html
  4558. Here is a list of places you might look into for examples of frequently
  4559. needed code fragments, or for packages people keep asking about:
  4560.    * Interrupt-driven support of peripheral devices and hooking hardware
  4561.      interrupts:
  4562.         - Alaric B. Williams <alaric@abwillms.demon.co.uk> maintains a
  4563.           library of utility functions and example handlers, useful for
  4564.           writing hardware interrupt handling code.  You can get Alaric's
  4565.           library with your Web browser, at this URL:
  4566.                http://www.abwillms.demon.co.uk/prog/libhw.zip
  4567.         - Bill Currie <bill_currie@MAIL.TAIT.CO.NZ> has written sample code
  4568.           for hardware interrupt handlers, e.g.
  4569.           ftp://ftp.delorie.com/pub/djgpp/contrib/sample-interrupt-handlers-v2.zip
  4570.           which should get you off the ground if you need to write your own
  4571.           handlers.
  4572.         - Martynas Kunigelis <martynas.kunigelis@vm.ktu.lt> donated a
  4573.           tutorial and a working code that installs a keyboard interrupt
  4574.           handler, e.g.
  4575.           ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/mkkbd3.zip that
  4576.           can also serve as a good example of a hardware interrupt handler.
  4577.         - you can look at the latest version of Sound Blaster support library
  4578.           at the Oulu repository, e.g.
  4579.           ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/sb05_dj2.zip or at
  4580.           the DJGPP server, e.g.
  4581.           ftp://ftp.delorie.com/pub/djgpp/contrib/sb05_dj2.zip; this package
  4582.           is maintained by Joel Hunter <jhunter@kendaco.telebyte.net>.
  4583.         - check out the example of hooking the timer interrupt, e.g.
  4584.           ftp://ftp.coast.net/Coast/msdos/c/pctime13.zip.
  4585.         - if you need a serial communications library, check out SVAsync,
  4586.           e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/svasync.zip.
  4587.    * Network support libraries:
  4588.         - the TCPLIB library, e.g.
  4589.           ftp://lab1.psy.univie.ac.at/pub/tcplib-dj200/tcplib-dj200.1.tar.gz
  4590.           provides the TCP/IP sockets interface.  (I am told that you can
  4591.           safely ignore the warnings you get when compiling the package.)
  4592.         - a port of WATTCP library, e.g.
  4593.           ftp://ftp.msen.com/pub/vendor/snsi/wattcp/gnu-c/.
  4594.    * Port of curses library to DJGPP:
  4595.         - download PDCurses package, e.g.
  4596.           ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/pdc22.zip.
  4597.    * X library:
  4598.         - the Xlibemu library, e.g. ftp://asterix.inescn.pt/pub/PC/X/ includes
  4599.           `Xt' and `Xmu' toolkits, a 3D version of the `AW' toolkit, a few
  4600.           demo applications (e.g. `xmine'), and can be used to compile
  4601.           `Tcl'/`Tk' and GNU Emacs with X support.  Xlibemu is based on X11R5
  4602.           and was developed by Antonio Costa <acc@asterix.inescn.pt> for
  4603.           DJGPP v1.x.  It is also available on an alternative site, e.g.
  4604.           ftp://groucho.idt-isep.ipp.pt/pub/pc/djgpp/etc/X/ and on the DJGPP
  4605.           server, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/Xlibemu/.
  4606.         - the Xlib and Xt for DV/X environment, e.g.
  4607.           ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v1tk/qddvx102.zip (you
  4608.           will also need qdlib102.zip and qdtkt102.zip from the same site).
  4609.    * Ports of various GNU utilities not included in DJGPP (like Fileutils,
  4610.      Grep, Less, etc.):
  4611.         - Look on SimTel mirrors in the GNUish, e.g.
  4612.           ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish/dos_only/ and
  4613.           Textutil, e.g. ftp://ftp.simtel.net/pub/simtelnet/msdos/textutil/
  4614.           directories.  These are 16-bit ports.
  4615.         - Marc Singer <elf@netcom.com> maintains a port of RCS, the Revision
  4616.           Control System, to DJGPP, e.g.
  4617.           ftp://ftp.netcom.com/pub/el/elf/rcsdos/.
  4618.    * Development environments:
  4619.         - Try the RHIDE system by Robert Hoehne
  4620.           <Robert.Hoehne@Mathematik.TU-Chemnitz.DE>.  RHIDE is in the last
  4621.           stages of beta-testing and is available via WWW, at this URL:
  4622.                http://www.tu-chemnitz.de/~rho/rhide.html
  4623.             and also from the DJGPP disribution sites, e.g.
  4624.           ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/
  4625.         - If you want the ultimate editing power, you might as well go for the
  4626.           best, which is of course the one-and-only GNU Emacs!  The latest
  4627.           version of Emacs is available from the GNU ftp sites, e.g.
  4628.           ftp://ftp.gnu.ai.mit.edu/pub/gnu/emacs-19.34b.tar.gz and will
  4629.           compile out of the box with DJGPP v2.  The DJGPP version supports
  4630.           menus, mouse, color syntax highlighting and many Emacs packages
  4631.           (like `ps-print' and `ediff') that previously didn't work on
  4632.           MS-DOS.  On Windows 95, Emacs compiled with DJGPP supports long
  4633.           filenames.
  4634.    * GUI libraries:
  4635.         - SWORD (the System of Windows for the ORganization of the Desktop)
  4636.           is a Graphic User Interface library made with C++ objects, written
  4637.           and maintained by Eric Nicolas <nicolas@JUPITER.saclay.cea.fr>.  The
  4638.           latest version 2.1 is available from the DJGPP v2tk subdirectory,
  4639.           e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/ as
  4640.           sw21_*.zip.
  4641.         - check out the BCGUI package, at this URL:
  4642.                http://www.delorie.com/djgpp/dl/contrib/
  4643.           or get BCGUI via FTP, e.g.
  4644.           ftp://ftp.delorie.com/pub/djgpp/contrib/bcguiNNN.zip or get BCGUI
  4645.           at Stephen Turnbull's server, e.g.
  4646.           ftp://turnbull.sk.tsukuba.ac.jp/pub/djgpp/packages/bcguiNNN.zip.
  4647.         - If you actually have the original Borland Turbo Vision, then you
  4648.           might want to get patches to compile Turbo Vision under DJGPP, e.g.
  4649.           ftp://ftp.uni-stuttgart.de/pub/systems/os2/programming/support/.
  4650.           For more info on this port, visit the TVPlus site, at this URL:
  4651.                http://www.zeta.org.au/~grove/tvhome.html
  4652.         - Another port of Turbo Vision library was done by Robert Hoehne
  4653.           <Robert.Hoehne@Mathematik.TU-Chemnitz.DE>, and can be downloaded
  4654.           via WWW, at this URL:
  4655.                http://www.tu-chemnitz.de/~rho/tvision.html
  4656.           , and also from the DJGPP distribution sites, e.g.
  4657.           ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/tvisionb.zip
  4658.    * Game programming:
  4659.         - Try the Jlib gaming/graphics library, e.g.
  4660.           ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/jlib_NNN.zip
  4661.           written by J P Griffiths <jpg@cs.waikato.ac.nz>.
  4662.         - Also see the Allegro game programming library, e.g.
  4663.           ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/alleg21.zip,
  4664.           written by Shawn Hargreaves <slh100@mailer.york.ac.uk>.  It is also
  4665.           available from the DJGPP archives, e.g.
  4666.           ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/alleg21.zip.
  4667.    * VGA Mode-X graphics:
  4668.         - Paul Fenwick <bg914@FreeNet.Carleton.CA> wrote an X-Mode package
  4669.           Xlib, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/xlibdj24.zip or
  4670.           Xlib at Oulu, e.g.
  4671.           ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/xlibdj24.zip.
  4672. File: djgppfaq.info,  Node: Symlinks,  Next: DPMI Spec,  Prev: Samples,  Up: Miscellany
  4673. 22.3 How to create symbolic links to programs
  4674. =============================================
  4675. **Q*: How do I create symbolic links?*
  4676. **Q*: I have this program that behaves differently depending on the name it's
  4677. called.  Under Unix, I just create symbolic links to achieve that, but DOS
  4678. doesn't support links.  Do I have to put several identical programs under
  4679. different names on my disk??*
  4680. *A* :  DJGPP allows you to simulate symbolic links to programs.  Generate a
  4681. stub (which is a small DOS program attached to every DJGPP program by the
  4682. `stubify.exe' program), call it by the name of the link you want, then edit
  4683. its header to run another program.  For example, let's say the real program
  4684. is `dj1.exe' and we want to make a link called `dj2.exe' that really calls
  4685. `dj1.exe.'  First, generate a stub under the name `dj2.exe.'  Next, run
  4686. `STUBEDIT' to modify the new program's stub info block and change the name of
  4687. the executable it runs.  In this case, we'd change it to `dj1':
  4688.       C:\USR\BIN> stubify -g dj2.exe
  4689.       C:\USR\BIN> stubedit dj2.exe runfile=dj1
  4690. Voila!  Now, when you run `dj2', it tells the stub to load the image of
  4691. `dj1', but pass "dj2" in `argv[0].'
  4692. File: djgppfaq.info,  Node: DPMI Spec,  Next: WWW,  Prev: Symlinks,  Up: Miscellany
  4693. 22.4 Where to find the DPMI specification?
  4694. ==========================================
  4695. **Q*: Where can I find the specifications for the DPMI functions?*
  4696. *A* :  You can find the DPMI 0.9 spec by anonymous ftp to one of the
  4697. following sites:
  4698. At the Quarterdeck ftp site, e.g. ftp://qdeck.com/pub/memory/dpmispec.zip.
  4699. At the Oulu repository of PC-specific programming info, e.g.
  4700. ftp://x2ftp.oulu.fi/pub/msdos/programming/specs/dpmispec.arj.
  4701. The DPMI 1.0 specs are available by anonymous ftp from the Intel anonymous
  4702. ftp site, e.g. ftp://ftp.intel.com/pub/IAL/software_specs/dpmiv1.txt.  (The
  4703. file `dpmip1.zip' at the same location is the PostScript version of this
  4704. spec.)
  4705. Some information about the DPMI API is also found in the Ralf Brown's
  4706. Interrupt List, e.g.
  4707. ftp://ftp.simtel.net/pub/simtelnet/msdos/info/inter50c.zip.  Look at the
  4708. functions of Interrupt 31h, or search the files for the word `DPMI.'
  4709. You can also browse the DPMI spec on-line, at this URL:
  4710.      http://www.delorie.com/djgpp/doc/dpmi/
  4711. File: djgppfaq.info,  Node: WWW,  Next: Upload,  Prev: DPMI Spec,  Up: Miscellany
  4712. 22.5 The DJGPP Web site.
  4713. ========================
  4714. **Q*: Where is the DJGPP Web site?*
  4715. *A* :  Yes, DJGPP has its own home on the Internet, set up and maintained by
  4716. (who else?) DJ Delorie <dj@delorie.com>.  It has an HTML version of this FAQ
  4717. list with search capabilities, the entire set of DJGPP distribution files, a
  4718. searchable archive of the DJGPP mailing list and news group traffic, plus
  4719. other useful and interesting information about DJGPP.  For instance, did you
  4720. ever wonder how DJGPP got started and what DJ's original goals were?
  4721. Rejoice: the Web site includes the story of DJGPP genesis, at this URL:
  4722.      http://www.delorie.com/djgpp/history.html
  4723. To visit, point your Web browser to the DJGPP Web site, at this URL:
  4724.      http://www.delorie.com/djgpp/
  4725. File: djgppfaq.info,  Node: Upload,  Next: Cross-DJGPP,  Prev: WWW,  Up: Miscellany
  4726. 22.6 Where to upload your contributions to DJGPP
  4727. ================================================
  4728. **Q*: I wrote a program using DJGPP.  How can I make it available to others?*
  4729. **Q*: I found and corrected a bug in one of the programs distributed with
  4730. DJGPP.  Where should I put it?*
  4731. *A* :  If the program/patches are small enough, consider posting it to the
  4732. mailing list or the comp.os.msdos.djgpp news group as uuencoded compressed
  4733. archive (to conserve space).
  4734. If the compressed file is larger than, say, 50K bytes, it's best to upload it
  4735. to a public site where everybody can get it.  You can upload your
  4736. contribution to a special directory on the DJ Delorie's FTP server, e.g.
  4737. ftp://ftp.delorie.com/incoming/.  This directory is write-only, and it gets
  4738. purged every couple of days, so be sure to write to DJ Delorie
  4739. <dj@delorie.com> about your upload; he will then move it to the
  4740. `/pub/djgpp/contrib' directory.  (There used to be another place, a directory
  4741. on `omnigate.clarkson.edu' which was writable by anonymous, but it was being
  4742. used for malicious purposes and the sysadmins there decided to close it :-(.)
  4743. If you decide to upload, please send mail to the `djgpp-announce' list with a
  4744. brief description of your program/patch.  (The message will get reflected to
  4745. both the news group and the DJGPP mailing list, so you don't have to
  4746. cross-post there, but it also goes to people who only subscribe to
  4747. djgpp-announce list because they want to get such announcements and nothing
  4748. else.)
  4749. If your program is more than a patch or a beta version, you might consider
  4750. uploading it to the DJGPP archives on SimTel.  If you decide to do it, write
  4751. to DJ Delorie <dj@delorie.com> and ask him for uploading instructions.
  4752. Material uploaded there gets automatically distributed to all of the SimTel
  4753. mirrors throughout the world, which makes it easier to get.
  4754. DJ Delorie requests that all contributed packages uploaded to his server be
  4755. source-only distributions; don't bother to include libraries or pre-compiled
  4756. binaries, since DJ deletes them when he opens the zip archive.  This is so
  4757. there will be no danger of distributing programs infected by a virus (as
  4758. there are no 32-bit virus-scanners yet).  Please avoid uploading
  4759. self-extracting archives because DJ extracts them on a Unix machine which
  4760. can't run DOS executables.
  4761. File: djgppfaq.info,  Node: Cross-DJGPP,  Next: 0xfe+0x20,  Prev: Upload,  Up: Miscellany
  4762. 22.7 DJGPP as cross-compiler
  4763. ============================
  4764. **Q*: I want to use DJGPP as a cross-compiler for Motorola 68K targets.  How
  4765. should I proceed about this?*
  4766. **Q*: I want to build GCC as a Unix-to-DOS cross-compiler.  What should I do?*
  4767. *A* :  If you want a cross-compiler for m68k on a DOS machine, you need is
  4768. DJGPP configured as `host=i386-go32', and `target=m68k-coff.' This has been
  4769. done already, e.g. ftp://ftp.lysator.liu.se/pub/msdos/gnu/gcc-dos-m68k/.  The
  4770. binaries there are based on GCC 2.6.0.  This package is reportedly no longer
  4771. supported, but if you have questions about it, you can send them to Jim
  4772. Karpinski <jk55@cornell.edu>.
  4773. For building GCC as a Unix-to-DOS cross-compiler, here are the instructions
  4774. on how to do it.  (Unfortunately, "make install" in the Gcc distribution does
  4775. exactly the wrong thing by default, so you end up copying a lot of stuff
  4776. around manually.)
  4777. First, use the original FSF distributions for Gcc and Binutils, not the
  4778. source distributions from DJGPP.  That's because the DJGPP archives have
  4779. sources patched to compile on MS-DOS and sometimes omit files that aren't
  4780. necessary for DJGPP.  In particular the GCC sources lack many files that the
  4781. MS-DOS build doesn't need.
  4782. Unpack Gcc and Binutils into a directory, let's call it `X/.'  Thus, you
  4783. have, say, `X/gcc-2.7.0' and `X/binutils-2.5.2.'  The following sequence of
  4784. commands should make the job:
  4785.      mkdir X/dos-binutils
  4786.      cd X/dos-binutils
  4787.      configure --target=i386-coff-go32
  4788.      make CFLAGS=-O
  4789.      
  4790.      mkdir -p /usr/local/i386-go32-msdos/bin
  4791.      
  4792.      cd binutils
  4793.      cp ar c++filt objcopy objdump size /usr/local/i386-go32-msdos/bin
  4794.      cp nm.new /usr/local/i386-go32-msdos/bin/nm
  4795.      cp strip.new /usr/local/i386-go32-msdos/bin/strip
  4796.      
  4797.      cd ../gas
  4798.      cp as.new /usr/local/i386-go32-msdos/bin/as
  4799.      cp gasp.new /usr/local/i386-go32-msdos/bin/gasp
  4800.      
  4801.      cd ../ld
  4802.      cp ld.new /usr/local/i386-go32-msdos/bin/ld
  4803.      
  4804.      cd ../../..
  4805.      mkdir X/dos-gcc
  4806.      cd X/dos-gcc
  4807.      configure --target=i386-go32-msdos
  4808.      # Note: this produces errors building libgcc.a.  Ignore them.
  4809.      # The libraries will come from the cross-compiler kit.
  4810.      make LANGUAGES=c CFLAGS=-O
  4811.      
  4812.      cp xgcc /usr/local/bin/gcc-dos
  4813.      cp cc1 /usr/local/i386-go32-msdos/bin/cc1
  4814.      cp cccp /usr/local/i386-go32-msdos/bin/cpp
  4815. Unzip the DJDev and Gcc distributions in, say, /usr/local/djgpp.  Ideally,
  4816. build libgcc.a on a DOS machine, or get it from the `djcrx200.zip' archive.
  4817. Remove all `^M' characters from include files (you can compile DTOU.c on the
  4818. Unix box to make this easier).  Alternatively, use the `-a' switch to UnZip
  4819. when unzipping the archives.
  4820. Change lib/djgpp.lnk to use "coff-i386" instead of "coff-go32" and remove the
  4821. `^M' characters from that file also.
  4822.      mkdir -p /usr/local/lib/gcc-lib/i386-go32-msdos/2.7.0
  4823.      cd /usr/local/lib/gcc-lib/i386-go32-msdos/2.7.0
  4824.      ln -s /usr/local/djgpp/include .
  4825.      ln -s /usr/local/djgpp/lib/* .
  4826. Build `stubify' and install it in `/usr/local/i386-go32-msdos/bin.'  You
  4827. might need to insert these two lines at the beginning of `stubify.c':
  4828.       `#include <sys/types.h>'
  4829.       `#include <unistd.h>'
  4830. That's it!  To build a program for DOS, say something like this:
  4831.       gcc-dos hello.c -o hello.exe
  4832. File: djgppfaq.info,  Node: 0xfe+0x20,  Next: Struct size,  Prev: Cross-DJGPP,  Up: Miscellany
  4833. 22.8 GCC says "garbage at end of number"
  4834. ========================================
  4835. **Q*: There is a severe bug in GCC: it says "garbage at end of number" for
  4836. this line:*
  4837.       i = 0xfe+0x20;
  4838. *Ain't it silly that such a great compiler would fail so miserably?*
  4839. *A* :  That's not a bug, that's a feature of the *ANSI C language
  4840. definition.*  By ANSI rules, the above expression is a single "preprocessing
  4841. token", unless you place whitespace in front of the plus sign.  The reason
  4842. for this seemingly counterintuitive feature is the syntax of floating-point
  4843. constants in which letters `e' and `E' followed immediately by a sign signal
  4844. a decimal exponent.  You can use the `-traditional' compiler switch to turn
  4845. this feature off (together with a plethora of other ANSI features; see the
  4846. GCC docs for details).
  4847. File: djgppfaq.info,  Node: Struct size,  Next: Struct packing,  Prev: 0xfe+0x20,  Up: Miscellany
  4848. 22.9 What should sizeof (struct xyzzy) return?
  4849. ==============================================
  4850. **Q*: When I call `sizeof' on a struct, I sometimes get values which are
  4851. larger than the sum of the sizes of the struct fields, whereas in Borland C++
  4852. I always get the correct result.  Is it a bug in GCC?*
  4853. **Q*: I have a program that reads struct contents from a binary file.  It
  4854. works OK when compiled with BC, but reads garbage when compiled with DJGPP.
  4855. This must be a bug in DJGPP, right?*
  4856. *A* : No, it's not a bug.  GCC generates 32-bit code, and in that mode, there
  4857. is a significant penalty (in terms of run-time performance) for unaligned
  4858. accesses, like accessing a 16-bit short which isn't aligned on a word
  4859. boundary, or accessing a 32-bit int which isn't aligned on a dword boundary.
  4860. To produce faster code, GCC pads struct fields so that each field can be
  4861. accessed without delays; this sometimes produces struct size which is larger
  4862. than the sum of the sizes of its fields.  If you need to minimize this
  4863. padding (e.g., if your program uses large arrays of such structs, where
  4864. padding will waste a lot of memory), lay out your structures so that the
  4865. longer fields are before the shorter ones.  For example, let's say that you
  4866. have a struct defined thus:
  4867.        struct my_struct {
  4868.          char name[7];
  4869.          unsigned long offset;
  4870.          double quality;
  4871.        };
  4872. To make such a struct use the least number of bytes, rearrange the fields,
  4873. like this:(1) (*note Struct size-Footnotes::)
  4874.        struct my_struct {
  4875.          double quality;
  4876.          unsigned long offset;
  4877.          char name[7];
  4878.        };
  4879. If the layout of the structure cannot be changed (e.g., when it must match
  4880. some external specification, like a block of data returned by some system
  4881. call), you can use the `__attribute__((packed))' extension of GCC (*Note the
  4882. Gcc docs: (gcc)Type Attributes.) to prevent GCC from padding the structure
  4883. fields; this will make accesses to some of the fields slower.
  4884. Beginning from version 2.7.0, GCC has a command-line option `-fpack-struct'
  4885. which causes GCC to pack all members of all structs together without any
  4886. holes, just as if you used `__attribute__((packed))' on every struct
  4887. declaration in the source file you compile with that switch.  If you use this
  4888. switch, be sure that source files which you compile with it don't use *any*
  4889. of the structures defined by library functions, or you will get some fields
  4890. garbled (because the library functions weren't compiled with that switch).
  4891. The padding of struct fields should be considered when you read or write
  4892. struct content from or to a disk file.  In general, this should only be done
  4893. if the file is read and written by the same program, because the exact layout
  4894. of the struct fields depends on some subtle aspects of code generation and
  4895. the compiler switches used, and these may differ between programs, even if
  4896. they were compiled by the same compiler on the same system.  If you do need
  4897. this method, be aware of the struct field padding and don't assume that the
  4898. number of the file bytes that the structure uses is equal to the sum of the
  4899. fields' sizes, even if you instructed the compiler to pack structs: GCC still
  4900. can add some padding after the last field.  So always use `sizeof struct foo'
  4901. to read and write a structure.
  4902. Another problem with porting programs that read structs from binary files is
  4903. that the size of some data types might be different under different
  4904. compilers.  Specifically, an `int' is 16-bit wide in most DOS-based
  4905. compilers, but in DJGPP it's 32-bit wide.
  4906. The best, most robust and portable way to read and write structs is through a
  4907. `char' buffer, which your code then uses to move the contents into or out of
  4908. the struct fields, one by one.  This way, you always know what you are doing
  4909. and your program will not break down if the padding rules change one day, or
  4910. if you port it to another OS/compiler.
  4911. File: djgppfaq.info,  Node: Struct size-Footnotes,  Up: Struct size
  4912. (1)  Note that this still allows the struct to be padded at the end, though.
  4913. File: djgppfaq.info,  Node: Struct packing,  Next: Int 24h,  Prev: Struct size,  Up: Miscellany
  4914. 22.10 C++ doesn't pack structs!
  4915. ===============================
  4916. **Q*: When I use `struct ffblk' from the header `dir.h' in a C++ program, I
  4917. get garbage in some fields of the structure!*
  4918. *A* :  There is a known bug in GCC 2.7.2: the C++ compiler effectively
  4919. ignores the `__attribute__((packed))' directives, so the structures end up
  4920. being not packed.  As a work-around, surround the declaration of the
  4921. structure that needs to be packed with `#pragma pack', like this:
  4922.        #ifdef __cplusplus
  4923.        #pragma pack(1)
  4924.        #endif
  4925.        .
  4926.        .
  4927.        .
  4928.        #ifdef __cplusplus
  4929.        #pragma pack()
  4930.        #endif
  4931. File: djgppfaq.info,  Node: Int 24h,  Next: go32-v2,  Prev: Struct packing,  Up: Miscellany
  4932. 22.11 How to avoid "Abort, Retry, Fail" messages
  4933. ================================================
  4934. **Q*: How do I write a program that accesses floppy and CD-ROM drives, but
  4935. avoids popping that "Abort, Retry, Fail?" message from DOS?*
  4936. **Q*: Other DOS compilers supply a function named `harderr' or `_harderr' to
  4937. hook the critical-error interrupt 24h, but DJGPP doesn't seem to have
  4938. these...*
  4939. *A* :  Under DPMI, Int 24h is always hooked by the DPMI server, since Int 24h
  4940. is issued by the real-mode DOS code, and it is not possible to terminate a
  4941. DPMI client (like DJGPP program) from real mode, if you press `A' in response
  4942. to that prompt.  The default handler under most DPMI servers will just set
  4943. `AL' register to 3 and `IRET', thus silently failing the DOS call that
  4944. triggered Int 24h.  The DJGPP startup code also hooks the protected-mode Int
  4945. 24h with a handler that fails the DOS call as described above.  So in most
  4946. circumstances you won't see that DOS prompt at all; your program will just
  4947. see a failed DOS call.
  4948. However, some DPMI hosts (notably, QDPMI), will sometimes crash your program
  4949. if it generates Int 24h, for instance when you access an empty floppy drive.
  4950. In such cases, or when the default action of failing the DOS call is not good
  4951. enough, you will have to hook Int 24h with your handler.  This should be done
  4952. in exactly the same manner as hooking hardware interrupts (*note how to set
  4953. an interrupt handler: Hardware interrupts.), because Int 24h is one of the
  4954. few software interrupts that, like all hardware interrupts, are always
  4955. reflected to the protected-mode handler first.  Note that `CWSDPMI' currently
  4956. doesn't support hooking Int 24h; if you set an interrupt handler, it won't be
  4957. called.
  4958. There are ways to avoid program crashes due to Int 24h (under those DPMI
  4959. hosts that exhibit this buggy behavior) other than to install a handler for
  4960. it.  For instance, you can test if the floppy drive is empty with a BIOS call
  4961. before accessing it with DOS functions; there are also similar ways to check
  4962. if a CD-ROM drive is empty.  The library function `getmntent' (*Note
  4963. getmntent: (libc.inf)getmntent.) can be used to detect all the drives that
  4964. can be safely accessed by DOS; or you can borrow some of the internal
  4965. functions used by `getmntent' from the library source distribution, e.g.
  4966. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djlsr200.zip.
  4967. File: djgppfaq.info,  Node: go32-v2,  Next: DXE,  Prev: Int 24h,  Up: Miscellany
  4968. 22.12 What is that `go32-v2.exe' program?
  4969. =========================================
  4970. **Q*: What is go32-v2 for?*
  4971. *A* :  The `go32-v2' program does the following:
  4972.    * With no command-line arguments, it prints the available physical and
  4973.      virtual memory, much like `go32' did in v1.x.
  4974.    * It can run unstubified v2 COFF images, like this:
  4975.            go32-v2 myprog
  4976.    * If you rename it to `go32.exe' and put on your `PATH' before the v1.x
  4977.      `go32.exe', it can also run a v1 COFF images, by loading the v1.x `go32'
  4978.      and letting it do the job.  With this setup, you can run v2 programs
  4979.      from v1.x programs, because the v1.x program will load `go32-v2' (since
  4980.      it found it first on the PATH) which knows how to run v2 images, instead
  4981.      the original `go32' which cannot.
  4982. File: djgppfaq.info,  Node: DXE,  Next: LFN,  Prev: go32-v2,  Up: Miscellany
  4983. 22.13 What is DXE?
  4984. ==================
  4985. **Q*: What is DXE?*
  4986. **Q*: Can I make a DLL using the DXE support?*
  4987. **Q*: Where can I find information or examples about writing/loading the DXE
  4988. files?*
  4989. *A* :  DXE is a limited facility to dynamically load code which is rarely
  4990. needed in DJGPP.  An example is the floating-point emulator code (*note the
  4991. details of DJGPP FP emulator: Emulation.) which is only used on those few
  4992. machines that lack an FPU.  The DXE design is intentionally limited to keep
  4993. it as simple as possible, so that the code that loads a DXE could be small
  4994. (it's a few hundreds bytes).  Because of this, there are a number of
  4995. limitations in the DXE mechanism that prevent using it for full-fledged
  4996. dynamic linking (i.e., a DLL).  For instance, the DXE module cannot access
  4997. variables or functions in the main module.  Unloading a DXE is also not
  4998. supported (but I'm told you can add this by making simple changes in the C
  4999. library).
  5000. The only place you can find some docs and examples of writing and using a DXE
  5001. is in the file `djtst200.zip' in the DJGPP "tests" distribution, e.g.
  5002. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djtst200.zip.  The example
  5003. there is *exceedingly* simplistic, but then so is the entire DXE mechanism...
  5004. File: djgppfaq.info,  Node: LFN,  Next: Missing separator,  Prev: DXE,  Up: Miscellany
  5005. 22.14 Long Filenames Don't Work!
  5006. ================================
  5007. **Q*: I cannot make Info find some of its files under Win95...*
  5008. **Q*: Why does Make behave as if some of the files were not there?*
  5009. *A* :  Are you running DJGPP under Win95 with long filename support enabled
  5010. (LFN=y in the environment)?  If so, set LFN=n from the DOS prompt and try
  5011. again.  If the problems go away, they are probably due to known bugs in some
  5012. DJGPP programs wrt the LFN support.  Make and Info are two programs which are
  5013. known to reveal these bugs.  Before you decide that you are a victim of these
  5014. bugs, though, make sure that all the files that your programs need to access
  5015. have been renamed to their long names.  For example, if Make needs to find a
  5016. file called `ALongFileName.cc' (because the Makefile tells it to build
  5017. `ALongFileName.o'), make sure there indeed is such a file in the directory.
  5018. Many times people use archive tools (like `PKZIP') that truncate long names,
  5019. even on Win95, when they open an archive, which leaves you with names like
  5020. `alongfil.cc', which is not the same as the original name when LFN is
  5021. supported.  Be sure to use archivers that support long filenames, e.g. use
  5022. `DJTAR' when you open `.tar.gz' archives, or rename all the files to their
  5023. original long names after you open the archive.
  5024. If the problems persist even though the filenames are correct, you will have
  5025. to disable LFN support (set LFN=n from the DOS prompt, setting it in
  5026. `DJGPP.ENV' does not always works) until these problems are fixed in some
  5027. future version of DJGPP.
  5028. File: djgppfaq.info,  Node: Missing separator,  Next: Zoneinfo,  Prev: LFN,  Up: Miscellany
  5029. 22.15 Make says "missing separator"
  5030. ===================================
  5031. **Q*: When I invoke Make, it refuses to do anything and prints this cryptic
  5032. message:*
  5033.        makefile:10: *** missing separator.  Stop.
  5034. *Now what kind of excuse is that?*
  5035. *A* : Unlike most other DOS Make programs which accept any whitespace
  5036. character at the beginning of a command in a rule, GNU Make insists that
  5037. every such line begins with a TAB.  (Most other Unix Make programs also
  5038. require TABs.)  Make sure that the line whose number is printed in the error
  5039. message (in this case, line 10) begins with a TAB.
  5040. There are editors that replace TABs with spaces, so even a Makefile that used
  5041. to work can become unworkable if you edit them with such an editor.
  5042. Another, more rare, cause of the above error message is if you use static
  5043. pattern rules (with the `%' character) incorrectly.  Read the documentation
  5044. that comes with Make carefully and try to find the error.
  5045. File: djgppfaq.info,  Node: Zoneinfo,  Next: FAQ format,  Prev: Missing separator,  Up: Miscellany
  5046. 22.16 What is in that `zoneinfo' directory?
  5047. ===========================================
  5048. **Q*: When I installed DJGPP v2, it created a directory named `zoneinfo' with
  5049. a lot of small files that take up 3.5MB of my disk space.  What are they for?
  5050. Can I delete them?*
  5051. *A* :  These files exist so that time-related library functions can correctly
  5052. calculate the offset between the local time and the "UTC" (Universal
  5053. Coordinated Time).  This offset is required when you get files from another
  5054. time-zone, like from the Internet, or when you download an archive that was
  5055. compressed in another time-zone.  If you don't care about file time stamps
  5056. being incorrect in such cases, you can delete all those files and never look
  5057. back.
  5058. You might wonder why we need all these zoneinfo files when the UTC offset
  5059. *is* required.  Well, the simplest way to tell programs what the UTC offset
  5060. is, is to have the user specify a single number which is the offset; but then
  5061. this number needs to be changed twice a year, to accommodate for the daylight
  5062. saving time.  Another, not-quite-so-simple way is to have the user specify
  5063. the current UTC offset and the DST rules; but this is a tedious and
  5064. error-prone process, and many users get it wrong.  Both of these methods have
  5065. the drawback that if the rules change, programs misinterpret old time-stamps,
  5066. since they treat them according to new rules.  Using a table that is read from
  5067. a file and includes the offset calculation rules for every year avoids all
  5068. these problems and requires the user to point the `TZ' environment variable
  5069. to the file that is pertinent to his/her time zone, which is easy:
  5070.       set TZ=c:/djgpp/zoneinfo/israel
  5071.       set TZ=c:/djgpp/zoneinfo/us/alaska
  5072. To find the rule suitable for your location, look into the `src' subdirectory
  5073. of `zoneinfo' and browse the file whose name is your continent/part of the
  5074. world.  If no binary file exists with the name of your zone, you can create
  5075. one with using the time-zone compiler `zic', whose source is also in the
  5076. `src' subdirectory.
  5077. A public domain time-zone database exists, and is updated from time to time
  5078. with the latest world-wide changes to the offset calculation rules.  (The
  5079. rules change because politicians in different countries make laws that change
  5080. the local clock settings.)  The contents of the `zoneinfo' directory which
  5081. comes with DJGPP is based on this database, but if you want the latest rules,
  5082. you can download them from the net, e.g. ftp://elsie.nci.nih.gov/pub/ as
  5083. `tzdata*.tar.gz'; `tzcode*.tar.gz' in the same directory includes the
  5084. programs that can be used to generate the offset tables from their source in
  5085. `tzdata*.tar.gz', the latest implementations of POSIX library functions that
  5086. use time-zone information, and the man pages that document the rules and the
  5087. software.  The last update as of this writing was in May 1996.
  5088. On any single machine, you don't need more than a single file from that
  5089. directory, which is the file for your time zone; once you find that file, you
  5090. can safely delete the rest.  But if you distribute a program that uses the TZ
  5091. setting, you will have to include all of the files, or tell your users how to
  5092. get and install them.
  5093. File: djgppfaq.info,  Node: FAQ format,  Prev: Zoneinfo,  Up: Miscellany
  5094. 22.17 Generating the FAQ in your favorite format
  5095. ================================================
  5096. **Q*: How can I generate the FAQ list in a format I'm used to?*
  5097. *A* :  First, you need to get the FAQ sources.  The sources of the latest
  5098. version of this FAQ list can always be found as `faq202s.zip' on DJ Delorie's
  5099. server, e.g. ftp://ftp.delorie.com/pub/djgpp/v2faq/faq202s.zip and on SimTel
  5100. mirrors, e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq202s.zip.
  5101. This includes the source file (written in Texinfo), and all the auxiliary
  5102. tools required to produce the Info, plain-ASCII, HTML, and a few other
  5103. versions of the FAQ list; the FAQ in all these formats is available in a
  5104. separate ZIP archive as `faq202b.zip' from DJ Delorie's server, e.g.
  5105. ftp://ftp.delorie.com/pub/djgpp/v2faq/faq202b.zip or from SimTel mirrors,
  5106. e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq202b.zip.  Currently,
  5107. this includes the Info version, the text (ASCII) version and an HTML version
  5108. as a single large `.html' file.  More formats will be available as the tools
  5109. for their generation are developed/tested.
  5110. If none of these formats is good enough for you, here are some tools
  5111. available to generate the FAQ list in other formats.  If you know about any
  5112. format not mentioned below that can be generated using widely available
  5113. tools, please drop me a note so I could update this list and consider that
  5114. format or those tools for inclusion in a future release of the FAQ.  If you
  5115. develop any such tools, consider uploading them to a site where they will be
  5116. publicly available, and tell me about that site.
  5117. Note that the FAQ source is a heavy user of the Texinfo macro facility, so
  5118. any conversion program that doesn't support Texinfo macros will probably have
  5119. hard time coping with the FAQ.  When confronted with this problem try feeding
  5120. the converter with the macro-expanded version of the FAQ (the Makefile in the
  5121. source distribution has a special target for such cases).
  5122. A program called `Makertf' can reportedly be used to convert a Texinfo
  5123. sources of this FAQ to the "Rich File Format" which can then either be
  5124. browsed by an RTF browser (such as Adobe Acrobat) or converted into a Windows
  5125. Help file with a Windows Help compiler.  `Makertf' is available from CCT
  5126. mirrors, e.g. ftp://ftp.coast.net/Coast/win3/winhelp/mkrtf104.zip.  The
  5127. Windows Help Compiler is available via anonymous ftp from the Microsoft ftp
  5128. site, e.g. ftp://ftp.microsoft.com/Softlib/MSFILES/HC305.EXE.
  5129. There also a program called `INFNG' that can be used to convert the Info
  5130. (*not* Texinfo) version of the FAQ to the Norton Guide format.  `INFNG' can
  5131. be downloaded from the DJGPP archive, e.g.
  5132. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/infng100.zip.
  5133. File: djgppfaq.info,  Node: About,  Next: Topic Index,  Prev: Miscellany,  Up: Top
  5134. 23. About this FAQ
  5135. ******************
  5136.   Maintainer: Eli Zaretskii <eliz@is.elta.co.il>.
  5137.   This FAQ is Copyright (C) 1994, 1995, 1996 by Eli Zaretskii
  5138. <eliz@is.elta.co.il>.  It may be freely redistributed with the DJGPP package
  5139. or any part thereof, provided that you don't prevent anybody else from
  5140. redistributing it on the same terms, and that this copyright notice is left
  5141. intact.
  5142.   Comments about, suggestions for, or corrections to this FAQ list are welcome.
  5143. Please make sure to include in your mail the version number of the document
  5144. to which your comments apply (you can find the version at the beginning of
  5145. this FAQ list).
  5146.   Much of the info in this FAQ list was taken from the DJGPP mailing list/news
  5147. group traffic, so many of you have (unbeknownst to you) contributed to this
  5148. list.  The following people read this list in its previous versions and
  5149. provided useful feedback, comments, information and/or suggestions:
  5150.      John M. Aldrich <fighteer@cs.com>
  5151.      Anthony Appleyard <A.APPLEYARD@fs2.mt.umist.ac.uk>
  5152.      John Bodfish <bodfish@austen.notis.com>
  5153.      Bill Davidson <bdavidson@ra.isisnet.com>
  5154.      Francois Charton <deef@pobox.oleane.com>
  5155.      Bill Currie <bill_currie@MAIL.TAIT.CO.NZ>
  5156.      DJ Delorie <dj@delorie.com>
  5157.      Juergen Erhard <jae@laden.ilk.de>
  5158.      Jeremy Filliben <prime@UDel.Edu>
  5159.      James W. Haefner <Jim@anolis.bnr.usu.edu>
  5160.      Koen Van Herck <kvhk@barco.com>
  5161.      Robert Hoehne <Robert.Hoehne@Mathematik.TU-Chemnitz.DE>
  5162.      Gordon Hogenson <ghogenso@u.washington.edu>
  5163.      Harry Johnston <omega@es.co.nz>
  5164.      Martynas Kunigelis <martynas.kunigelis@vm.ktu.lt>
  5165.      Pieter Kunst <kunst@prl.philips.nl>
  5166.      Y. Lazarovitch <yitzg@haven.ios.com>
  5167.      Alexander Lehmann <lehmann@mathematik.th-darmstadt.de>
  5168.      Marty Leisner <leisner@sdsp.mc.xerox.com>
  5169.      Dave Love <d.love@dl.ac.uk>
  5170.      Rob Nader <naderr@topaz.cqu.edu.au>
  5171.      Eric Nicolas <nicolas@JUPITER.saclay.cea.fr>
  5172.      Elliott Oti <e.oti@stud.warande.ruu.nl>
  5173.      Esa A E Peuha <peuha@cc.helsinki.fi>
  5174.      Walter Prins <prins@quark.cs.sun.ac.za>
  5175.      Steve Salter <salters@admin.fanshawec.on.ca>
  5176.      Charles Sandmann <sandmann@clio.rice.edu>
  5177.      Terrel Shumway <Shumw001@Cerritos.edu>
  5178.      Andrew Szymkowiak <aes@solia.gsfc.nasa.gov>
  5179.      Launey Thomas <ljt@sierrasemi.com>
  5180.      Chris Tilbury <C.J.Tilbury@estate.warwick.ac.uk>
  5181.      Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp>
  5182.      Santiago Vila <sanvila@pizarro.unex.es>
  5183.      Ronan Waide <waider@waider.ie>
  5184.      Morten Welinder <terra@diku.dk>
  5185.      Anthony Edward Wesley <awesley@galaxy.anutech.com.au>
  5186.      Mark H. Wood <mwood@mhw.OIT.IUPUI.EDU>
  5187. File: djgppfaq.info,  Node: Topic Index,  Next: Program Index,  Prev: About,  Up: Top
  5188. 24. Topic Index
  5189. ***************
  5190.   This is an alphabetical list of all the topics covered in this FAQ.  Use it
  5191. to search for a description of your problem and follow the link to find the
  5192. answer(s).
  5193. * Menu:
  5194. * !proxy method of passing long command lines: Long commands.
  5195. * "Far" declarations, porting to DJGPP:  NEAR and FAR.
  5196. * "Huge" declarations, porting to DJGPP: NEAR and FAR.
  5197. * "Near" declarations, porting to DJGPP: NEAR and FAR.
  5198. * -ansi switch and C++-style comments in C programs: C++ comments.
  5199. * -fconserve-space switch:               Large image.
  5200. * -fstrength-reduce optimization, disabled by default: Faster v1.
  5201. * -msoft-float switch to GCC:            -msoft-float.
  5202. * -traditional switch and C++-style comments in C programs: C++ comments.
  5203. * .lib libraries, using with GCC:        OBJ and LIB.
  5204. * .obj object files, using with GCC:     OBJ and LIB.
  5205. * 16-bit code, using with DJGPP:         16-bit code.
  5206. * 68K targets, cross-compiling with DJGPP: Cross-DJGPP.
  5207. * @ character, how to pass it to programs: Special chars.
  5208. * ^Z character at end of DJGPP.ENV:      Buggy DPMI.
  5209. * __crt0_glob_function, disable filename globbing: Disable globbing.
  5210. * __DJGPP__ pre-processor symbol:        DJGPP-specific.
  5211. * __dpmi_get_memory_information, doesn't change after free/malloc: Confusing alloc.
  5212. * __dpmi_get_protected_mode_interrupt_vector: Hardware interrupts.
  5213. * __dpmi_get_real_mode_interrupt_vector: Hardware interrupts.
  5214. * __dpmi_int, calling DOS/BIOS services: int86.
  5215. * __dpmi_int, high in program's profile: I/O bound programs.
  5216. * __dpmi_int, how to pass buffers:       Pointer segment.
  5217. * __dpmi_int, use to invoke software interrupts: Zero SP.
  5218. * __dpmi_simulate_real_mode_interrupt, need zero SS, SP and FLAGS: Zero SP.
  5219. * __dpmi_YYY vs _go32_XXX, which one to use: _go32 vs __dpmi.
  5220. * __GO32__ pre-processor symbol:         DJGPP-specific.
  5221. * __pure_virtual, unresolved function:   Pure virtual.
  5222. * __tb, an alias for the address of transfer buffer: Pointer segment.
  5223. * _go32_dpmi_allocate_iret_wrapper:      Hardware interrupts.
  5224. * _go32_dpmi_chain_protected_mode_interrupt_vector: Hardware interrupts.
  5225. * _go32_remaining_physical_memory, doesn't change after free/malloc: Confusing alloc.
  5226. * _go32_XXX vs __dpmi_YYY, which one to use: _go32 vs __dpmi.
  5227. * _stklen, setting stack size:           Stack size.
  5228. * Accessing absolute addresses above 1MB: Above 1MB.
  5229. * Accessing absolute addresses in conventional memory: Xfer.
  5230. * Accessing C variables from inline assembly: Inline Asm.
  5231. * Accessing VBE 2.0 linear frame buffer: Direct access.
  5232. * Accessing video memory:                Direct access.
  5233. * Alignment of data by GAS can slow-down code: Pentium.
  5234. * Announcements, mailing list:           Subscribing.
  5235. * Archives, DJGPP mailing list/News group, how to search: Deja vu.
  5236. * argv[0] when program runs under a debugger: How to debug.
  5237. * Asking for help:                       Totally lost.
  5238. * Assembly source, code produced by Gas: Gas bugs.
  5239. * Assembly source, converting to AT&T syntax: Converting ASM.
  5240. * Assembly source, converting to protected mode: ASM GPF.
  5241. * Assembly source, GCC/Gas syntax:       Syntax.
  5242. * Assembly syntax:                       Syntax.
  5243. * AT&T vs Intel assembly syntax:         Syntax.
  5244. * atan, inaccuracies with FP emulator:   Emulator accuracy.
  5245. * Automated downloading from a PC:       DJGPP = Fatware.
  5246. * Automated downloading from a Unix box: DJGPP = Fatware.
  5247. * Automated FTP from a Unix box:         DJGPP = Fatware.
  5248. * Automatic variables, how much memory:  Stack size.
  5249. * Bad format, profiler error message:    Gprof needs COFF.
  5250. * Binary data I/O:                       File data corrupted.
  5251. * BIOS service calls:                    int86.
  5252. * BIOS service calls which need buffers: Pointer segment.
  5253. * BIOS setup, influence on compilation speed: Slow compiler.
  5254. * Browsing documentation:                Where is the docs.
  5255. * Buffered I/O, effect of buffer size on I/O speed: I/O speed.
  5256. * Bug report, how to submit:             Changing.
  5257. * Bug-tracking system for DJGPP:         Changing.
  5258. * Bugs, how to browse a list of known DJGPP problems: Changing.
  5259. * C library, legal restrictions:         Redistribution.
  5260. * C programs compilation, recommended system RAM: Minimum.
  5261. * C++ class variables under GDB:         C++ classes in GDB.
  5262. * C++ method names under GDB:            C++ classes in GDB.
  5263. * C++ programs compilation, recommended system RAM: Minimum.
  5264. * C++ programs, large executable:        Large image.
  5265. * C++ programs, problems with packed structs: Struct packing.
  5266. * C++ source, debugger cannot find:      GDB and C++ source.
  5267. * C++ STL library, not in lgp271b distribution: Unresolved externals.
  5268. * C++, missing header files:             Missing C++ headers.
  5269. * C++-style comments in C programs, GCC won't compile: C++ comments.
  5270. * Calling 16-bit code from DJGPP:        16-bit code.
  5271. * calloc fails under EMM386 or HIMEM:    EMM386 alloc.
  5272. * calloc fails under QDPMI or Windows:   QDPMI alloc.
  5273. * calloc fails under Windows 3.x:        Windows alloc.
  5274. * calloc fails under Windows 95:         Win9x alloc.
  5275. * calloc, effect on "Fat DS":            Fat DS.
  5276. * Can't find node "Top", Info message:   Info can't find ``Top''.
  5277. * CCT mirrors' list:                     CCT.
  5278. * CD-ROM, getting DJGPP:                 DJGPP by WWW.
  5279. * Chaining interrupt:                    Hardware interrupts.
  5280. * Changing GNU/DJGPP programs:           Changing.
  5281. * Child processes, spawning under OS/2:  OS/2.
  5282. * Child programs, how much memory is left: Swap out.
  5283. * Class method name in GDB:              C++ classes in GDB.
  5284. * Class static variable name in GDB:     C++ classes in GDB.
  5285. * Code is slow due to incorrect alignment by GAS: Pentium.
  5286. * Code page change might prevent MSHELL from working: Debug graphics.
  5287. * Code quality, GCC:                     How fast.
  5288. * Code speed, slower than in v1.x:       Faster v1.
  5289. * Code, DJGPP-specific:                  DJGPP-specific.
  5290. * COFF output from linker, how to get:   GDB needs COFF.
  5291. * COFF output, required for profiling:   Gprof needs COFF.
  5292. * Color text cannot be printed with `printf': Screen I/O.
  5293. * Command line, disabling filename expansion/globbing: Disable globbing.
  5294. * Command line, escaping special characters: Special chars.
  5295. * Command line, filename expansion/globbing: Filename globbing.
  5296. * Command lines, longer than 126 characters: Long commands.
  5297. * Command-line arguments:                Command line.
  5298. * Comments, C++-style in C programs:     C++ comments.
  5299. * Commercial programs, writing with DJGPP: Applications.
  5300. * Compatibility, hardware, general:      Requirements.
  5301. * Compatibility, Linux:                  Minimum.
  5302. * Compatibility, Novell NWDOS 7:         Minimum.
  5303. * Compatibility, operating systems, general: Requirements.
  5304. * Compatibility, OS/2:                   Minimum.
  5305. * Compatibility, Warp:                   Minimum.
  5306. * Compatibility, Windows 3.x:            Minimum.
  5307. * Compatibility, Windows 9x:             Minimum.
  5308. * Compatibility, Windows/NT:             Minimum.
  5309. * Compilation for debugging:             How to debug.
  5310. * Compilation messages, bogus:           Which language.
  5311. * Compilation progress, GCC switch:      GCC optimizations.
  5312. * Compilation speed:                     Slow compiler.
  5313. * Compile-time problems:                 Compiling.
  5314. * Compiler crashes, which subprogram of: General trouble.
  5315. * Compiler speed:                        Compiler performance.
  5316. * Compiling GCC and CPP:                 Reasonable hardware.
  5317. * Compiling GCC and CPP, RAM disk:       Config.
  5318. * Compiling large programs, disk cache settings: Reasonable hardware.
  5319. * Compiling large programs, RAM disk settings: Reasonable hardware.
  5320. * Compiling large source files:          Reasonable hardware.
  5321. * Compiling Objective C sources:         Objective C.
  5322. * Complex class is not in libgpp.a:      Class Complex.
  5323. * Complex class, porting to libgpp.a 2.7.1 and later: Class Complex.
  5324. * Complex template class:                Class Complex.
  5325. * Compressing DJGPP executables:         Large executable.
  5326. * Configuration, for optimal performance: Config.
  5327. * Configuration, reasonable:             Reasonable hardware.
  5328. * Configuration, the best:               Optimal hardware.
  5329. * Conventional memory, moving data to/from: Xfer.
  5330. * Conversion of the FAQ to different formats: FAQ format.
  5331. * Converting DOS .obj/.lib files to GCC: OBJ and LIB.
  5332. * Converting DOS code to DJGPP:          Converting.
  5333. * Coprocessor setup, change with _control87: Numeric exceptions.
  5334. * Copyleft, effect on DJGPP:             Applications.
  5335. * Copyright issues:                      Legalese.
  5336. * Crash traceback, how to read:          Crash traceback.
  5337. * Crash, DJGPP programs:                 Trouble.
  5338. * Crash, numeric exception:              Numeric exceptions.
  5339. * Crashes, general troubleshooting:      General trouble.
  5340. * Crashes, v2.0 programs:                v2.x crash.
  5341. * Critical error handling in DJGPP:      Int 24h.
  5342. * Cross-compiling with DJGPP:            Cross-DJGPP.
  5343. * crt0.o, GCC can't find:                Missing headers/libraries.
  5344. * Ctrl-C in debugged programs:           Debugging woes.
  5345. * Curses library for DJGPP:              Samples.
  5346. * Cygnus GCC port to Windows:            Windows/NT.
  5347. * Cygnus port of GCC for WinNT and Win95: Windows apps.
  5348. * DEADBEAF, use to spot uninitialized memory: v2.x crash.
  5349. * Debugger cannot find C++ source:       GDB and C++ source.
  5350. * Debugger causes programs to overflow the stack: Stack size.
  5351. * Debugger crashes on programs compiled for profiling: Debugging woes.
  5352. * Debugger crashes on programs which use exceptions: Debugging woes.
  5353. * Debugger crashes under QEMM/QDPMI:     Old QDPMI.
  5354. * Debugger doesn't know about #include'd source: Included source.
  5355. * Debugger doesn't pass signals to debuggee: Debugging woes.
  5356. * Debugger, usage:                       How to debug.
  5357. * Debuggers for DJGPP programs:          How to debug.
  5358. * Debuggers use transfer buffer:         Transfer buffer.
  5359. * Debugging C++ programs:                GDB and C++ source.
  5360. * Debugging C/C++ code generated by a program: Included source.
  5361. * Debugging graphics programs:           Debug graphics.
  5362. * Debugging issues:                      Debugging.
  5363. * Debugging symbols, how to strip from executables: Large executable.
  5364. * Debugging with GDB, needs COFF output: GDB needs COFF.
  5365. * Development environments for DJGPP:    Samples.
  5366. * Differences between SimTel and CCT ftp sites: Where to find.
  5367. * Direct hardware access on Win/NT:      Windows/NT.
  5368. * Disabling globbing in filenames:       Disable globbing.
  5369. * Disabling QDPMI:                       Old QDPMI.
  5370. * Disabling virtual memory for CWSDPMI:  Slow compiler.
  5371. * Disabling wildcard expansion:          Disable globbing.
  5372. * Disk cache, influence on compilation speed: Slow compiler.
  5373. * Disk cache, recommended settings:      Config.
  5374. * Disk cache, when compiling large programs: Reasonable hardware.
  5375. * Disk space, required for installation: Minimum.
  5376. * Disk space, using less of it:          DJGPP = Fatware.
  5377. * Distributing DJGPP programs:           Distributing.
  5378. * Distributing DJGPP programs, FP emulator: Emulation.
  5379. * DJGPP applications, legal restrictions: Applications.
  5380. * DJGPP archives, how to search:         Deja vu.
  5381. * DJGPP as cross-compiler:               Cross-DJGPP.
  5382. * DJGPP distribution, list of:           What to download.
  5383. * DJGPP Documentation:                   Docs.
  5384. * DJGPP documentation, in man page format: Man pages.
  5385. * DJGPP documentation, in PostScript format: Ready PS.
  5386. * DJGPP documentation, look in source distributions: Can't find docs.
  5387. * DJGPP documentation, printing:         Printed docs.
  5388. * DJGPP documentation, reading as ASCII file: No Info.
  5389. * DJGPP documentation, reading with a Web browser: Ready PS.
  5390. * DJGPP documentation, see source files: Last resort.
  5391. * DJGPP documentation, where to find it: Where is the docs.
  5392. * DJGPP environment variable, how to set and test: Missing headers/libraries.
  5393. * DJGPP environment variable, setting under LFN: Missing headers/libraries.
  5394. * DJGPP mailing list, duplicate messages: Duplicates.
  5395. * DJGPP mailing list, how to post:       Mailing list.
  5396. * DJGPP mailing list, how to subscribe:  Subscribing.
  5397. * DJGPP mailing list, how to unsubscribe: Unsubscribing.
  5398. * DJGPP mailing list, in digest form:    Subscribing.
  5399. * DJGPP mailing list, no messages:       Silent list.
  5400. * DJGPP mailing list/news group, read via WWW: Unsubscribing.
  5401. * DJGPP News group:                      Newsgroup.
  5402. * DJGPP News group, reading via WWW:     Subscribing.
  5403. * DJGPP programs, problems with:         Trouble.
  5404. * DJGPP programs, problems with DPMI host: Buggy DPMI.
  5405. * DJGPP programs, profiling:             How to profile.
  5406. * DJGPP software, where to upload:       Upload.
  5407. * DJGPP users, asking for help:          Totally lost.
  5408. * DJGPP utilities, legal restrictions:   Redistribution.
  5409. * DJGPP v2.0, alternative DPMI hosts:    Environment.
  5410. * DJGPP won't run, prints "No DPMI":     No DPMI.
  5411. * DJGPP, a list of packages:             What to download.
  5412. * DJGPP, downloading via e-mail:         DJGPP by WWW.
  5413. * DJGPP, downloading with FTP:           How to download.
  5414. * DJGPP, downloading with Gopher:        DJGPP by WWW.
  5415. * DJGPP, downloading with WWW:           DJGPP by WWW.
  5416. * DJGPP, how to get it:                  Getting DJGPP.
  5417. * DJGPP, sample code:                    Samples.
  5418. * DJGPP, what it is:                     DJGPP.
  5419. * DJGPP, where to download:              Where to find.
  5420. * DJGPP-ANNOUNCE mailing list:           Subscribing.
  5421. * DJGPP-compiled programs can't find DPMI: Distributing.
  5422. * DJGPP-specific code:                   DJGPP-specific.
  5423. * DJGPP.ENV syntax explained:            Missing headers/libraries.
  5424. * DJGPP.ENV, trailing junk crashes Info: Buggy DPMI.
  5425. * djgpp_first_ctor, unresolved by linker: djgpp_first_ctor.
  5426. * djgpp_first_dtor, unresolved by linker: djgpp_first_ctor.
  5427. * Documentation, converting to plain ASCII: No Info.
  5428. * Documentation, converting to PostScript format: Printed docs.
  5429. * Documentation, in man page format:     Man pages.
  5430. * Documentation, in PostScript format:   Ready PS.
  5431. * Documentation, inside source distribution archives: Can't find docs.
  5432. * Documentation, reading:                Where is the docs.
  5433. * Documentation, the profiler:           Gprof docs.
  5434. * DOS code, using with GCC:              16-bit code.
  5435. * DOS libraries, using with GCC:         OBJ and LIB.
  5436. * DOS object files, using with GCC:      OBJ and LIB.
  5437. * DOS programs, converting to DJGPP:     Converting.
  5438. * DOS service calls:                     int86.
  5439. * DOS service calls which need buffers:  Pointer segment.
  5440. * DOSEmu, incompatibilities with DJGPP:  DOSEmu.
  5441. * Downloading DJGPP via e-mail:          How to download.
  5442. * Downloading DJGPP with FTP:            How to download.
  5443. * Downloading DJGPP with WWW:            DJGPP by WWW.
  5444. * DPMI host bugs, might crash DJGPP programs: Buggy DPMI.
  5445. * DPMI hosts, commercially available:    Environment.
  5446. * DPMI services, problems with Novell NWDOS 7: Minimum.
  5447. * DPMI services, required to run DJGPP:  Minimum.
  5448. * DPMI spec, where to get it:            DPMI Spec.
  5449. * DPMI, required to run DJGPP programs:  Distributing.
  5450. * Duplicate messages from DJGPP mailing list: Duplicates.
  5451. * DXE can be debugged with EDEBUG32:     How to debug.
  5452. * DXE description:                       DXE.
  5453. * DXE docs and examples:                 DXE.
  5454. * E-mail, downloading DJGPP:             DJGPP by WWW.
  5455. * Emulation, floating-point:             Floating point.
  5456. * Emulator library:                      Emulation.
  5457. * Emulator, floating-point inaccuracies: Emulator accuracy.
  5458. * Environment size affects spawning child programs: How long.
  5459. * Environment variables, DJGPP:          Optimal hardware.
  5460. * Environment variables, linker:         Libraries' order.
  5461. * Error messages, redirecting to a file: Redirect.
  5462. * Excessive paging, tuning CWSDPMI:      Config.
  5463. * EXE compressor for DJGPP:              Large executable.
  5464. * Executable size, how to make smaller:  Large executable.
  5465. * Executable, bloated by static array:   Large image.
  5466. * Executable, how to strip off debugging symbols: Large executable.
  5467. * FAQ, conversion to different formats:  FAQ format.
  5468. * Far pointer memory access:             Direct access.
  5469. * Farptr functions, mask off 12 higher bits of address: 20 bits.
  5470. * Fatal signal, GCC message:             Fatal signal.
  5471. * File format not recognized by GCC:     Which language.
  5472. * Filename globbing:                     Filename globbing.
  5473. * Filename globbing, disabling:          Disable globbing.
  5474. * Filename wildcards expansion:          Filename globbing.
  5475. * Filename wildcards, disabling expansion: Disable globbing.
  5476. * Files, minimum set to download:        What to download.
  5477. * Files, reading and writing:            File data corrupted.
  5478. * Files, required disk space:            Disk space.
  5479. * Floating-point emulation:              Floating point.
  5480. * Floating-point emulation doesn't work: Emulation.
  5481. * Floating-point emulation under debugger: Debugging woes.
  5482. * Floating-point emulation, -msoft-float switch: -msoft-float.
  5483. * Floating-point emulation, non-DJGPP emulators: Other emulators.
  5484. * Floating-point emulation, under OS/2:  OS/2 emulation.
  5485. * Floating-point exception in Objective-C program: SIGFPE with ObjC.
  5486. * Floating-point issues:                 Floating point.
  5487. * Floating-point math functions, standard and high-quality: Unresolved externals.
  5488. * Floating-point, debugger support:      How to debug.
  5489. * FP_SEG and FP_OFF, porting to DJGPP:   NEAR and FAR.
  5490. * free doesn't change virtual memory:    Confusing alloc.
  5491. * FTP, downloading DJGPP:                How to download.
  5492. * FTP, downloading DJGPP in batch mode:  DJGPP = Fatware.
  5493. * Functions from libm.a crash with SIGFPE: SIGFPE in ldexp.
  5494. * Functions, which is in what library:   Which library.
  5495. * Game programming, libraries and techniques for DJGPP: Samples.
  5496. * Garbage at end of number, GCC message: 0xfe+0x20.
  5497. * GCC aborts with "Internal compiler error": Fatal signal.
  5498. * GCC can't recognize file format:       Which language.
  5499. * GCC can't recognize source language:   Which language.
  5500. * GCC crashes, which subprogram of:      General trouble.
  5501. * GCC hangs/crashes under Make:          Make hangs.
  5502. * GCC says "Fatal signal X":             Fatal signal.
  5503. * Getting DJGPP <1>:                     Getting DJGPP.
  5504. * Getting DJGPP:                         Where to find.
  5505. * getting DJGPP from a CD-ROM:           DJGPP by WWW.
  5506. * Getting documentation:                 Where is the docs.
  5507. * Getting more help:                     Help.
  5508. * Globbing in filenames:                 Filename globbing.
  5509. * Globbing in filenames, disabling:      Disable globbing.
  5510. * GNU Copyleft, effect on DJGPP:         Applications.
  5511. * GNU development utilities, port to DJGPP: Samples.
  5512. * GNU News groups, don't post DJGPP problems: DJGPP isn't GNU.
  5513. * GNU packages, how to change:           Changing.
  5514. * Gopher, downloading DJGPP:             DJGPP by WWW.
  5515. * gotoxy doesn't work with `printf':     Screen I/O.
  5516. * GPL, effect on DJGPP:                  Applications.
  5517. * Graphics driver setup:                 Which driver.
  5518. * Graphics issues:                       Graphics.
  5519. * Graphics programs, debugging:          Debug graphics.
  5520. * Graphics screen messed up under Windows: GRX and Windows.
  5521. * Graphics, direct video access:         Direct access.
  5522. * Graphics, limitations on Win/NT:       Windows/NT.
  5523. * Gurus, asking for help:                Totally lost.
  5524. * Hang, all DJGPP programs:              Buggy DPMI.
  5525. * Hang, DJGPP programs:                  Trouble.
  5526. * harderr function, emulating under DJGPP: Int 24h.
  5527. * Hardware interrupt handler crashes:    HW Int pitfalls.
  5528. * Hardware interrupts, hooking:          Hardware interrupts.
  5529. * Hardware interrupts, subtleties:       HW Int pitfalls.
  5530. * Hardware requirements:                 Requirements.
  5531. * Hardware requirements, minimal:        Minimum.
  5532. * Hardware-oriented programming:         Low-level.
  5533. * Header files, C++, GCC can't find:     Missing C++ headers.
  5534. * Header files, GCC can't find:          Missing headers/libraries.
  5535. * Help, asking for:                      Totally lost.
  5536. * HTML format, DJGPP documentation:      Ready PS.
  5537. * I/O speed, DJGPP programs:             I/O speed.
  5538. * i286:                                  i286.
  5539. * i386SX:                                Minimum.
  5540. * Inaccuracies, using emulator:          Emulator accuracy.
  5541. * Including source code, problems with debugging: Included source.
  5542. * Incompatibilities, i286:               i286.
  5543. * Incompatibilities, Linux DOSEmu:       DOSEmu.
  5544. * Incompatibilities, OS/2:               OS/2.
  5545. * Incompatibilities, Warp:               OS/2.
  5546. * Incompatibilities, Windows/NT:         Windows/NT.
  5547. * Info won't display a file:             Info can't find ``Top''.
  5548. * Inline assembly, how to write:         Inline Asm.
  5549. * Inline functions, linker won't find:   Still unresolved.
  5550. * inp function:                          Ports.
  5551. * Int 24h crashes DJGPP programs:        Int 24h.
  5552. * int86 crashes program:                 int86.
  5553. * int86x/intdosx, how to pass a buffer:  Pointer segment.
  5554. * intdos crashes program:                int86.
  5555. * Intel assembly syntax, converting to AT&T: Converting ASM.
  5556. * Intel vs AT&T assembly syntax:         Syntax.
  5557. * Interactive programs, screen I/O:      Screen I/O.
  5558. * Internal compiler error, when compiling C++ programs: Fatal signal.
  5559. * Interrupt 24h handling:                Int 24h.
  5560. * Interrupt chaining:                    Hardware interrupts.
  5561. * Interrupt frequency, maximum:          HW Int pitfalls.
  5562. * Interrupt handlers, locking memory:    HW Int pitfalls.
  5563. * Interrupt reflection:                  Hardware interrupts.
  5564. * Interrupt reflection overhead:         HW Int pitfalls.
  5565. * Interrupts handlers in DJGPP:          Hardware interrupts.
  5566. * Invoking v2 programs from v1.x programs: go32-v2.
  5567. * Keyboard interrupt cannot be hooked under debugger: Debugging woes.
  5568. * Keystrokes don't get to keyboard handler: HW Int pitfalls.
  5569. * Known bugs in DJGPP, how to browse:    Changing.
  5570. * ldexp crashes programs with FP exception: SIGFPE in ldexp.
  5571. * Legal aspects of DJGPP programming:    Legalese.
  5572. * Legal restrictions on DJGPP apps:      Applications.
  5573. * Legal restrictions, DJGPP utilities:   Redistribution.
  5574. * Length of command line:                How long.
  5575. * Letter case in filenames submitted to GCC: Which language.
  5576. * LFN API, not supported on Win/NT:      Windows/NT.
  5577. * LFN problems:                          LFN.
  5578. * LGPL, effect on DJGPP:                 Applications.
  5579. * libc2.tex, missing file:               Printed docs.
  5580. * Libraries, converting to DJGPP:        Converting.
  5581. * Libraries, GCC can't find:             Missing headers/libraries.
  5582. * Libraries, order on compilation/link command line: Libraries' order.
  5583. * Libraries, searching for functions:    Which library.
  5584. * Library docs, missing libc2.tex:       Printed docs.
  5585. * Library functions, C++, linker won't find: Still unresolved.
  5586. * Library functions, linker won't find:  Unresolved externals.
  5587. * Library functions, linker won't find in non-default directories: Libraries' order.
  5588. * Library functions, linker won't find, libraries' order: Libraries' order.
  5589. * Library, floating-point emulation:     Emulation.
  5590. * Linear address, mask off 12 higher bits: 20 bits.
  5591. * Linear frame buffer access:            Direct access.
  5592. * Link-time problems:                    Compiling.
  5593. * Linker fails because of Win95 shortcut files: Win95 LNK files.
  5594. * Linker fails for large libraries or object files: Large object files.
  5595. * Linker fails to find crt0.o under Novell: Missing headers/libraries.
  5596. * Linker fails to produce executable under Novell: No EXE.
  5597. * Linker speed:                          Compiler performance.
  5598. * linker won't find djgpp_first_dtor symbol: djgpp_first_ctor.
  5599. * Linking C++ programs, use the GXX driver: Unresolved externals.
  5600. * Linking programs, unresolved C++ library functions: Still unresolved.
  5601. * Linking programs, unresolved library functions: Unresolved externals.
  5602. * Linking programs, unresolved library functions, libraries' order: Libraries' order.
  5603. * Linking speed, improve by stub-editing ld.exe: Slow linker.
  5604. * Links, symbolic, simulation with DJGPP: Symlinks.
  5605. * List of DJGPP packages:                What to download.
  5606. * Locking memory for hardware interrupt handlers: Hardware interrupts.
  5607. * Locking memory for interrupt handlers: HW Int pitfalls.
  5608. * Long command lines:                    Long commands.
  5609. * Long command lines, from Makefile:     Makefiles.
  5610. * Long command lines, maximum length:    How long.
  5611. * long filename support, bugs:           LFN.
  5612. * Long Filenames aren't supported on Win/NT: Windows/NT.
  5613. * Long filenames in setting DJGPP env. variable: Missing headers/libraries.
  5614. * Low-level programming issues:          Low-level.
  5615. * Machines with low extended RAM, tuning CWSDPMI: Config.
  5616. * Makefile, first character of every command must be TAB: Missing separator.
  5617. * Makefile, passing long command lines:  Makefiles.
  5618. * Makefiles with long command lines:     Long commands.
  5619. * malloc doesn't change virtual memory:  Confusing alloc.
  5620. * malloc fails under EMM386 or HIMEM:    EMM386 alloc.
  5621. * malloc fails under QDPMI or Windows:   QDPMI alloc.
  5622. * malloc fails under Windows 3.x:        Windows alloc.
  5623. * malloc fails under Windows 95:         Win9x alloc.
  5624. * malloc, effect on "Fat DS":            Fat DS.
  5625. * Man pages, how to read:                Man pages.
  5626. * Math functions crash with SIGFPE:      SIGFPE in ldexp.
  5627. * Maximum interrupt frequency:           HW Int pitfalls.
  5628. * Maximum length of command line:        How long.
  5629. * Memory allocation fails under EMM386 or HIMEM: EMM386 alloc.
  5630. * Memory allocation fails under QDPMI or Windows 95: QDPMI alloc.
  5631. * Memory allocation fails under Windows 3.x: Windows alloc.
  5632. * Memory allocation fails under Windows 95: Win9x alloc.
  5633. * Memory at run time:                    Memory.
  5634. * Memory locking for hardware interrupt handlers: Hardware interrupts.
  5635. * Memory manager, settings for optimal performance: Config.
  5636. * Memory, how much is left for spawned programs: Swap out.
  5637. * Memory, virtual, failure to allocate:  QDPMI VM.
  5638. * Memory, virtual, free doesn't change:  Confusing alloc.
  5639. * Memory, virtual, malloc doesn't change: Confusing alloc.
  5640. * Memory, virtual, maximum available:    How much memory.
  5641. * Memory, virtual, QDPMI failure:        QDPMI VM.
  5642. * Memory-mapped devices above 1MB:       Above 1MB.
  5643. * Memory-mapped devices, fast access:    Fat DS.
  5644. * Memory-mapped devices, moving data to/from: Xfer.
  5645. * Method name in C++, how to pass to GDB: C++ classes in GDB.
  5646. * Minimal hardware requirements:         Minimum.
  5647. * Minimum system RAM:                    Minimum.
  5648. * Minimum system RAM, CWSDPMI:           Minimum.
  5649. * Missing C++ header files:              Missing C++ headers.
  5650. * Missing crt0.o:                        Missing headers/libraries.
  5651. * Missing header files:                  Missing headers/libraries.
  5652. * Missing libraries:                     Missing headers/libraries.
  5653. * Missing separator, Make error message: Missing separator.
  5654. * Mixing v2.0 GCC with CC1PLUS from v1.x, Unknown filetype message.: Unknown filetype.
  5655. * Mixing v2.x Make with v1.x programs hangs the machine: Make hangs.
  5656. * MK_FP macro, porting to DJGPP:         NEAR and FAR.
  5657. * Mode switches, effect on program speed: How fast.
  5658. * Monochrome monitor, redirecting screen output: Debug graphics.
  5659. * More help, how to get:                 Help.
  5660. * Motorola 68K targets, cross-compiling with DJGPP: Cross-DJGPP.
  5661. * Mouse handler with DJGPP:              RMCB.
  5662. * movedata, mask off 12 higher bits of address: 20 bits.
  5663. * Moving data to and from conventional memory: Xfer.
  5664. * Moving data to and from transfer buffer: Xfer.
  5665. * MS-Windows header file windows.h, where to get it: Windows apps.
  5666. * MS-Windows programming under DJGPP:    Windows apps.
  5667. * Nearptr functions:                     Fat DS.
  5668. * Nearptr functions, mask off 12 higher bits of address: 20 bits.
  5669. * nearptr method of direct memory access: Xfer.
  5670. * Nested programs, how much memory is left: Swap out.
  5671. * Network installation makes linking slow: Slow linker.
  5672. * New features in v2.0:                  New and improved.
  5673. * No DPMI error message:                 No DPMI.
  5674. * No messages from the mailing list:     Silent list.
  5675. * Non-DJGPP floating-point emulators:    Other emulators.
  5676. * Not COFF error message from DJGPP programs: Unknown filetype.
  5677. * Novell NDOS, buggy DPMI services crash DJGPP: Buggy DPMI.
  5678. * Novell, linker or STUBIFY don't produce executable: No EXE.
  5679. * Null pointer dereference crashes v2.0 programs: v2.x crash.
  5680. * Numeric exception, program crash:      Numeric exceptions.
  5681. * Objective C, compiling:                Objective C.
  5682. * Objective-C programs crash with FP exception: SIGFPE with ObjC.
  5683. * Old CWSDPMI, influence on compilation speed: Slow compiler.
  5684. * Optimal performance, CWSDPMI tuning:   Config.
  5685. * Optimal performance, disk cache settings: Config.
  5686. * Optimal performance, RAM disk settings: Config.
  5687. * Optimal performance, system configuration: Config.
  5688. * Optimization crashes GCC:              GCC optimizations.
  5689. * Optimizing DJGPP programs:             How to profile.
  5690. * outp function:                         Ports.
  5691. * Overhead, interrupt reflection to protected mode: HW Int pitfalls.
  5692. * Packages, DJGPP, list of:              What to download.
  5693. * Packages, ported to DJGPP:             Samples.
  5694. * Packages, required disk space:         Disk space.
  5695. * Packages, which to download:           What to download.
  5696. * Packed structs, C++ bug:               Struct packing.
  5697. * Packing the structs:                   Struct size.
  5698. * Page fault error message from CWSDPMI: v2.x crash.
  5699. * Paging starts before all RAM is used:  EMM386 alloc.
  5700. * Peek/poke absolute address:            Xfer.
  5701. * Performance issues:                    Performance.
  5702. * Peripheral devices above 1MB:          Above 1MB.
  5703. * Peripheral devices, fast access:       Fat DS.
  5704. * Peripheral devices, reading/writing ports: Ports.
  5705. * Peripherals, moving data to/from:      Xfer.
  5706. * Pi, accurate computation:              Emulator accuracy.
  5707. * Port reading/writing:                  Ports.
  5708. * Ported programs run much slower:       Slow-down.
  5709. * Posting problems, not to GNU News groups: DJGPP isn't GNU.
  5710. * Posting to DJGPP mailing list:         Mailing list.
  5711. * PostScript documentation:              Printed docs.
  5712. * PostScript documentation, ready-to-print: Ready PS.
  5713. * Pre-processor symbols, DJGPP-specific: DJGPP-specific.
  5714. * printf cannot print color text:        Screen I/O.
  5715. * Printing DJGPP documentation:          Printed docs.
  5716. * Problems with DJGPP programs:          Trouble.
  5717. * Problems, asking for help:             Totally lost.
  5718. * Problems, searching for solution in DJGPP archives: Deja vu.
  5719. * Profiled programs crash under debugger: Debugging woes.
  5720. * Profiler documentation:                Gprof docs.
  5721. * Profiler produces no output:           No profile.
  5722. * Profiling DJGPP programs:              How to profile.
  5723. * Profiling DJGPP programs, need COFF output: Gprof needs COFF.
  5724. * Profiling issues:                      Profiling.
  5725. * Profiling programs that terminate abnormally: No profile.
  5726. * Profiling, library routines:           I/O bound programs.
  5727. * Program crashes accessing empty floppy/CD-ROM drives: Int 24h.
  5728. * Program crashes because of Int 24h:    Int 24h.
  5729. * Program crashes in int86/intdos:       int86.
  5730. * Program crashes in v2.0, but not in v1.x: v2.x crash.
  5731. * Program crashes while allocating memory: QDPMI alloc.
  5732. * Programs crash with SIGSEGV due to small stack size: Stack size.
  5733. * Programs crash, general troubleshooting: General trouble.
  5734. * Programs crash, numeric exception:     Numeric exceptions.
  5735. * Programs crash, saving debugging output: Redirect.
  5736. * Programs crash, searching DJGPP archives: Deja vu.
  5737. * Programs that exit abnormally, how to profile: No profile.
  5738. * Protected mode and converted assembly code: ASM GPF.
  5739. * Protected-mode interrupt vector:       Hardware interrupts.
  5740. * QEMM auto/off mode, conflicts with DJGPP: QEMM AUTO.
  5741. * Quotes, how to pass them to programs:  Special chars.
  5742. * RAM disk, influence on compilation speed: Slow compiler.
  5743. * RAM disk, recommended settings:        Config.
  5744. * RAM disk, when compiling large programs: Reasonable hardware.
  5745. * RCS port to DJGPP:                     Samples.
  5746. * Read DJGPP traffic via WWW:            Unsubscribing.
  5747. * Reading an int from a binary file:     Struct size.
  5748. * Reading documentation:                 Where is the docs.
  5749. * Reading documentation with text editor/viewer: No Info.
  5750. * Reading documentation, converting to plain ASCII: No Info.
  5751. * Reading structs from disk files:       Struct size.
  5752. * Real-mode call-back:                   RMCB.
  5753. * Real-mode interrupt vector:            Hardware interrupts.
  5754. * Real-mode services, calling DJGPP functions: RMCB.
  5755. * realloc, effect on "Fat DS":           Fat DS.
  5756. * Reboot, every DJGPP program:           Buggy DPMI.
  5757. * Reboot, when running DJGPP programs:   Trouble.
  5758. * Recommended system RAM, for C programs compilation: Minimum.
  5759. * Recommended system RAM, for C++ programs compilation: Minimum.
  5760. * Recompiling GCC:                       Changing.
  5761. * Redirecting GCC messages to a file:    Redirect.
  5762. * Redirection in Makefile, effect on long command lines: Makefiles.
  5763. * Redirection, using the REDIR program:  Makefiles.
  5764. * Required hardware, general:            Requirements.
  5765. * Response file, passing long command lines: Long commands.
  5766. * Run-time environment in v2.0:          Environment.
  5767. * Run-time performance:                  Performance.
  5768. * Run-time problems:                     Running.
  5769. * Runtime speed, slower than in v1.x:    Faster v1.
  5770. * sbrk, effect on "Fat DS":              Fat DS.
  5771. * Screen contents not restored under Windows: GRX and Windows.
  5772. * Screen I/O:                            Screen I/O.
  5773. * Searching DJGPP archives:              Deja vu.
  5774. * setvbuf, effect on I/O speed:          I/O speed.
  5775. * SHELL= variable in Makefile, effect on long command lines: Makefiles.
  5776. * Shortcut files under Win95 fail DJGPP linker: Win95 LNK files.
  5777. * Signals in debugged programs:          Debugging woes.
  5778. * SimTel mirrors' list:                  Where to find.
  5779. * Size of a struct under DJGPP:          Struct size.
  5780. * Slow code, due to bad alignment by GAS: Pentium.
  5781. * Slow compilation:                      Slow compiler.
  5782. * Slow compilation, tuning CWSDPMI:      Config.
  5783. * Slow linking, possible reasons:        Slow linker.
  5784. * Slow-down, programs ported from other compilers: Slow-down.
  5785. * Software interrupts, need zero SS, SP and FLAGS: Zero SP.
  5786. * Solved problems, searching in DJGPP archives: Deja vu.
  5787. * Sound Blaster code for DJGPP:          Samples.
  5788. * Source files, using as the best docs:  Last resort.
  5789. * Spawned programs, how much memory is left: Swap out.
  5790. * Spawning child processes, OS/2:        OS/2.
  5791. * Spawning programs, effect of environment size: How long.
  5792. * Spawning v2 programs from v1.x programs: go32-v2.
  5793. * Spawning v2.x programs from v1.x programs doesn't work: Make hangs.
  5794. * Speed of compilation:                  Slow compiler.
  5795. * Stack dump, how to read:               Crash traceback.
  5796. * Stack overflow under debugger:         Stack size.
  5797. * Stack size under DJGPP:                Stack size.
  5798. * Stack size, insufficient, causes programs to crash: Stack size.
  5799. * Stand-alone DJGPP programs that don't need DPMI: Distributing.
  5800. * Standard output/error stream, redirecting to a file: Redirect.
  5801. * Static array enlarges C++ executable:  Large image.
  5802. * STL library, not in lgp271b distribution: Unresolved externals.
  5803. * struct reading from a disk file:       Struct size.
  5804. * Struct, size in bytes under DJGPP:     Struct size.
  5805. * Structure packing, C++ bug:            Struct packing.
  5806. * Structure padding:                     Struct size.
  5807. * Subscription to DJGPP mailing list:    Subscribing.
  5808. * Subsidiary programs, how much memory is left: Swap out.
  5809. * SVGA types supported by GRX:           Which driver.
  5810. * Symbolic links, simulation with DJGPP: Symlinks.
  5811. * System configuration, the best:        Optimal hardware.
  5812. * System RAM, minimum:                   Minimum.
  5813. * Systems programming issues:            Low-level.
  5814. * TAB, must be the first character of every command: Missing separator.
  5815. * TABs replaced with spaces by a text editor: Missing separator.
  5816. * TCP/IP library for DJGPP:              Samples.
  5817. * Text-mode video memory access:         Direct access.
  5818. * Timer interrupts code for DJGPP:       Samples.
  5819. * Traceback, how to read:                Crash traceback.
  5820. * Tracing compilation progress with -Q:  GCC optimizations.
  5821. * Transfer buffer, mask off 12 higher bits of address: 20 bits.
  5822. * Transfer buffer, moving data:          Xfer.
  5823. * Transfer buffer, use when debugging:   Transfer buffer.
  5824. * Transfer buffer, using to call DOS/BIOS: Pointer segment.
  5825. * Tuning CWSDPMI for optimal performance: Config.
  5826. * Turbo Vision, DJGPP port:              Samples.
  5827. * TZ database updates, where to get:     Zoneinfo.
  5828. * TZ variable, how to set:               Zoneinfo.
  5829. * Uninitialized memory crashes v2.0 programs: v2.x crash.
  5830. * Unix-like sbrk algorithm considered harmful for HW interrupts: HW Int pitfalls.
  5831. * Unix-to-DOS cross-compiling with DJGPP: Cross-DJGPP.
  5832. * Unknown filetype, GCC message:         Unknown filetype.
  5833. * Unresolved __pure_virtual function in C++: Pure virtual.
  5834. * Unresolved externals:                  Unresolved externals.
  5835. * Unresolved externals in C++ programs, use GXX: Unresolved externals.
  5836. * Unresolved externals, C++:             Still unresolved.
  5837. * unresolved externals, djgpp_first_ctor: djgpp_first_ctor.
  5838. * Unsubscribing from the DJGPP mailing list: Unsubscribing.
  5839. * Unsupported DOS request message:       int86.
  5840. * Unsupported INT message:               int86.
  5841. * Uploading DJGPP software:              Upload.
  5842. * v2 code slower than v1.x:              Faster v1.
  5843. * V2.0, new environment:                 Environment.
  5844. * V2.0, new features and bug fixes:      v2.
  5845. * v2.0, program crashes:                 v2.x crash.
  5846. * V86 mode, QEMM and CWSDPMI problems:   QEMM AUTO.
  5847. * VBE 2.0 linear frame buffer access:    Direct access.
  5848. * VESA support by GRX:                   Which driver.
  5849. * VGA Mode-X graphics for DJGPP:         Samples.
  5850. * Video memory, direct access:           Direct access.
  5851. * Virtual memory:                        Memory.
  5852. * Virtual memory under Windows 95:       Win9x alloc.
  5853. * Virtual memory, failure to allocate:   QDPMI VM.
  5854. * Virtual memory, free doesn't change:   Confusing alloc.
  5855. * Virtual memory, how to disable it for CWSDPMI: Slow compiler.
  5856. * Virtual memory, malloc doesn't change: Confusing alloc.
  5857. * Virtual memory, maximum available:     How much memory.
  5858. * Virtual memory, QDPMI failure:         QDPMI VM.
  5859. * Virus infection cause "Not COFF" message: Unknown filetype.
  5860. * Web site for DJGPP:                    WWW.
  5861. * Weekly digest, problems in receiving:  Subscribing.
  5862. * Wildcards expansion:                   Filename globbing.
  5863. * Wildcards expansion, disabling:        Disable globbing.
  5864. * Win32 programming with GCC:            Windows apps.
  5865. * Windows applications with DJGPP:       Windows apps.
  5866. * WinNT/Win95 programming with Cygnus GCC port: Windows apps.
  5867. * WWW services for DJGPP:                WWW.
  5868. * WWW, downloading DJGPP:                DJGPP by WWW.
  5869. * X emulation for DJGPP:                 Samples.
  5870. * Zoneinfo directory:                    Zoneinfo.
  5871. File: djgppfaq.info,  Node: Program Index,  Prev: Topic Index,  Up: Top
  5872. 25. Program Index
  5873. *****************
  5874.   This index lists the problems and solutions by the program/package to which
  5875. they pertain.  If you know what program or package gives you the trouble,
  5876. look it up here.
  5877. * Menu:
  5878. * 386Max, how to ensure virtual memory:  QDPMI VM.
  5879. * 386Max, speeding up DJGPP start-up:    QDPMI VM.
  5880. * 4DOS, redirecting GCC messages to a file: Redirect.
  5881. * _control87, change coprocessor setup:  Numeric exceptions.
  5882. * _crt0_startup_flags settings and QDPMI: QDPMI VM.
  5883. * _crt0_startup_flags, setting to lock memory: HW Int pitfalls.
  5884. * _crt0_startup_flags, Unix sbrk is incompatible with HW interrupts: HW Int pitfalls.
  5885. * _string.h, GCC can't find:             Missing C++ headers.
  5886. * AutoWinNet, automated downloading:     DJGPP = Fatware.
  5887. * BatchFTP, automated downloading from a Unix box: DJGPP = Fatware.
  5888. * BCCBGI (from BCC2GRX) crashes with the default stack: Stack size.
  5889. * Bison doesn't imply GPL/LGPL:          Applications.
  5890. * Bison, debugging generated code:       Included source.
  5891. * C compiler overflows its stack for large programs: Fatal signal.
  5892. * C++ class libraries, legal restrictions: Applications.
  5893. * C++ compiler crashes for large programs: Stack size.
  5894. * C++ compiler overflows its stack for large programs: Fatal signal.
  5895. * Cawf, using to read man pages:         Man pages.
  5896. * CC1PLUS crashes with SIGSEGV:          Stack size.
  5897. * CHCP DOS command might prevent MSHELL from working: Debug graphics.
  5898. * complex.h functions, linker can't find: Still unresolved.
  5899. * Complex.h, GCC can't find:             Missing C++ headers.
  5900. * CPP, compiling, memory requirements:   Reasonable hardware.
  5901. * CPP, compiling, RAM disk:              Config.
  5902. * CTRL87, control numeric exceptions:    Numeric exceptions.
  5903. * CWSDPMI allows "Fat DS":               Fat DS.
  5904. * CWSDPMI crashes programs allocating memory is small chunks: QDPMI alloc.
  5905. * CWSDPMI crashes programs which dereference NULL pointers: v2.x crash.
  5906. * CWSDPMI doesn't support hooking Int 24h: Int 24h.
  5907. * CWSDPMI runs out of virtual memory:    Fatal signal.
  5908. * CWSDPMI, alternative DPMI hosts:       Environment.
  5909. * CWSDPMI, disabling virtual memory:     Slow compiler.
  5910. * CWSDPMI, legal restrictions:           Redistribution.
  5911. * CWSDPMI, maximum available virtual memory: How much memory.
  5912. * CWSDPMI, memory usage for nested programs: Swap out.
  5913. * CWSDPMI, minimum required system RAM:  Minimum.
  5914. * CWSDPMI, old (beta) versions slow-down compilation: Slow compiler.
  5915. * CWSDPMI, pages too early under EMM386: EMM386 alloc.
  5916. * CWSDPMI, problems with QEMM auto/off mode: QEMM AUTO.
  5917. * CWSDPMI, setting parameters for optimal performance: Config.
  5918. * CWSDPMI, should be distributed with DJGPP programs: Distributing.
  5919. * CWSDPR0 reduces interrupt reflection overhead: HW Int pitfalls.
  5920. * CWSDPR0, use for testing HW interrupt handlers: Hardware interrupts.
  5921. * CWSPARAM, a program to tune CWSDPMI performance: Config.
  5922. * DJGPP.ENV syntax explained:            Missing headers/libraries.
  5923. * DJGPP.ENV, beware of blanks when setting: Missing headers/libraries.
  5924. * DJGPP.ENV, compiler environment variables: Missing headers/libraries.
  5925. * DJGPP.ENV, linker environment variables: Libraries' order.
  5926. * DJP, an executable compressor for DJGPP: Large executable.
  5927. * DOSEMU doesn't allow "Fat DS":         Fat DS.
  5928. * EDEBUG32 can debug a DXE:              How to debug.
  5929. * EMACS can be compiled with DJGPP:      Samples.
  5930. * Emacs, reading docs:                   Where is the docs.
  5931. * Emacs, reading Info files:             Where is the docs.
  5932. * Emacs, using to read man pages:        Man pages.
  5933. * EMM386, cannot use all free memory:    EMM386 alloc.
  5934. * EMM386, effect on max interrupt frequency: HW Int pitfalls.
  5935. * EMM386, malloc/calloc fails:           EMM386 alloc.
  5936. * EMM386, settings for optimal performance: Config.
  5937. * emTeX, printing the docs:              Printed docs.
  5938. * emu387.dxe, distribution with DJGPP programs: Emulation.
  5939. * EMX/GCC, writing Windows applications: Windows apps.
  5940. * EMXAOUT converter from .obj to COFF format: OBJ and LIB.
  5941. * F2C, debugging generated code:         Included source.
  5942. * Flex doesn't imply GPL/LGPL:           Applications.
  5943. * Flex, debugging generated code:        Included source.
  5944. * FSDB crashes under QEMM/QDPMI:         Old QDPMI.
  5945. * FSDB, the full-screen debugger:        How to debug.
  5946. * Gas can introduce errors into assembly code: Gas bugs.
  5947. * GCC can't find C++ headers:            Missing C++ headers.
  5948. * GCC can't find crt0.o:                 Missing headers/libraries.
  5949. * GCC can't find headers:                Missing headers/libraries.
  5950. * GCC can't find libraries:              Missing headers/libraries.
  5951. * GCC cannot resolve djgpp_first_ctor symbol when linking: djgpp_first_ctor.
  5952. * GCC crashes during optimization:       GCC optimizations.
  5953. * GCC crashes, which subprogram of:      General trouble.
  5954. * GCC doesn't pack structs in C++ programs: Struct packing.
  5955. * GCC doesn't recognize .lib libraries:  OBJ and LIB.
  5956. * GCC doesn't recognize .obj object files: OBJ and LIB.
  5957. * GCC doesn't recognize file format:     Which language.
  5958. * GCC from v2.x crashes under v1.x Make: Make hangs.
  5959. * GCC hangs under Make:                  Make hangs.
  5960. * GCC says "garbage at end of number":   0xfe+0x20.
  5961. * GCC won't compile C++-style comments in C programs: C++ comments.
  5962. * GCC won't find inline functions without -O: Still unresolved.
  5963. * GCC, -fconserve-space switch:          Large image.
  5964. * GCC, -msoft-float switch:              -msoft-float.
  5965. * GCC, -v switch shows the compilation passes: Which language.
  5966. * GCC, assumes C++ source is .cc:        GDB and C++ source.
  5967. * GCC, code efficiency:                  How fast.
  5968. * GCC, compiling for debugging:          How to debug.
  5969. * GCC, compiling, memory requirements:   Reasonable hardware.
  5970. * GCC, compiling, RAM disk:              Config.
  5971. * GCC, environment variables:            Missing headers/libraries.
  5972. * GCC, file source language recognition: Which language.
  5973. * GCC, I/O speed:                        I/O speed.
  5974. * GCC, inline assembly facilities:       Inline Asm.
  5975. * GCC, maximum length of command line in Makefiles: How long.
  5976. * GCC, passing long command lines via Makefile: Makefiles.
  5977. * GCC, recompiling:                      Changing.
  5978. * GCC, redirecting messages to a file:   Redirect.
  5979. * GCC, slow compilation:                 Slow compiler.
  5980. * GDB cannot restart the debuggee:       How to debug.
  5981. * GDB causes stack overflow in a debuggee: Stack size.
  5982. * GDB crashes under QEMM/QDPMI:          Old QDPMI.
  5983. * GDB doesn't pass command-line arguments to debuggee: How to debug.
  5984. * GDB GP Faults on breakpoint under Windows: Debugging woes.
  5985. * GDB needs COFF output:                 GDB needs COFF.
  5986. * GDB, conflicts with file redirection:  How to debug.
  5987. * GDB, debugging DJGPP programs:         How to debug.
  5988. * GDB, debugging graphics programs:      Debug graphics.
  5989. * GDB, how is it different on MS-DOS:    How to debug.
  5990. * GDB, how to use C++ class variables' names: C++ classes in GDB.
  5991. * GDB, how to use C++ method names:      C++ classes in GDB.
  5992. * GDB, init file name:                   How to debug.
  5993. * GDB, name of the READLINE init file:   How to debug.
  5994. * GDB, slow loading of symbols and sources: How to debug.
  5995. * go32-v2 usage:                         go32-v2.
  5996. * go32-v2, use to find out how much memory is available to DJGPP: EMM386 alloc.
  5997. * Gprof cannot find program:             Gprof needs COFF.
  5998. * Gprof documentation:                   Gprof docs.
  5999. * gprof produces no output:              No profile.
  6000. * Gprof says "bad format":               Gprof needs COFF.
  6001. * Gprof, documentation:                  Can't find docs.
  6002. * Gprof, the GNU profiler:               How to profile.
  6003. * Groff, port to DJGPP:                  Man pages.
  6004. * Groff, using to read man pages:        Man pages.
  6005. * GRX, supported SVGA types:             Which driver.
  6006. * gxx driver, not in gcc272b distribution: Unresolved externals.
  6007. * gxx driver, searches C++ libraries automatically: Unresolved externals.
  6008. * HIMEM, malloc/calloc fails:            EMM386 alloc.
  6009. * INFNG, produces the FAQ in Norton Guides format: FAQ format.
  6010. * Info crashes due to ^Z or whitespace at end of DJGPP.ENV: Buggy DPMI.
  6011. * Info crashes under QDPMI:              Buggy DPMI.
  6012. * Info won't display a file:             Info can't find ``Top''.
  6013. * Info, a stand-alone docs browser:      Where is the docs.
  6014. * Info, using to read man pages:         Man pages.
  6015. * iostream functions, linker can't find: Still unresolved.
  6016. * iostream library, why use it:          Unresolved externals.
  6017. * iostream.h, GCC can't find:            Missing C++ headers.
  6018. * LaTeX, printing the docs:              Printed docs.
  6019. * ld fails for large libraries and object files: Large object files.
  6020. * LD linker, linker script defines djgpp_first_ctor: djgpp_first_ctor.
  6021. * ld, how to improve linking speed:      Slow linker.
  6022. * Less, using to read man pages:         Man pages.
  6023. * Lex, debugging generated code:         Included source.
  6024. * libemu.a FP emulation library:         Emulation.
  6025. * libg++ library:                        Unresolved externals.
  6026. * libgpp library:                        Unresolved externals.
  6027. * libgpp.a, legal restrictions:          Applications.
  6028. * libiostream.a, legal restrictions:     Applications.
  6029. * libstdc++ standard templates library:  Unresolved externals.
  6030. * Linker can't find library functions:   Unresolved externals.
  6031. * Linker can't find library functions in non-default directories: Libraries' order.
  6032. * Linker can't find some C++ library functions: Still unresolved.
  6033. * Linker, environment variables:         Libraries' order.
  6034. * Linker, how to get COFF output:        GDB needs COFF.
  6035. * Linker, order of libraries in the command line: Libraries' order.
  6036. * Linux doesn't allow "Fat DS":          Fat DS.
  6037. * Linux, compatibility:                  Minimum.
  6038. * Linux, needs a patch to run nested programs: DOSEmu.
  6039. * Make crashes on DOSEmu:                DOSEmu.
  6040. * Make crashes on OS/2:                  OS/2.
  6041. * Make error message "missing separator": Missing separator.
  6042. * Make requires floating point:          Changing.
  6043. * Make, GCC hangs when invoked from it:  Make hangs.
  6044. * Make, maximum length of command line to pass to GCC: How long.
  6045. * Make, passing long command lines via Makefile: Makefiles.
  6046. * Makeinfo, using to convert Info files to plain ASCII: No Info.
  6047. * MAKERTF, produces the FAQ in RTF format: FAQ format.
  6048. * Man program for DJGPP docs:            Man pages.
  6049. * math library, default ANSI/ISO and high-quality functions: Unresolved externals.
  6050. * More, using to read man pages:         Man pages.
  6051. * Mosaic, downloading DJGPP:             DJGPP by WWW.
  6052. * MSHELL fails because of TSR programs:  Debug graphics.
  6053. * MSHELL, redirecting screen output:     Debug graphics.
  6054. * NDOS, buggy DPMI services crash DJGPP: Buggy DPMI.
  6055. * Netscape, downloading DJGPP:           DJGPP by WWW.
  6056. * NM, printing library contents:         Which library.
  6057. * Novell 3.x, linker doesn't find crt0.o: Missing headers/libraries.
  6058. * Novell NWDOS 7, buggy DPMI services:   Minimum.
  6059. * Novell NWDOS 7, compatibility:         Minimum.
  6060. * NWDOS, buggy DPMI services crash DJGPP: Buggy DPMI.
  6061. * OBJ2COFF converter from .obj to COFF format: OBJ and LIB.
  6062. * OBJDUMP segment overrides bugs:        Gas bugs.
  6063. * Objective C, compilation problems:     Objective C.
  6064. * Objective-C, cannot run on machines without FPU: SIGFPE with ObjC.
  6065. * obstack package:                       Unresolved externals.
  6066. * OS/2 Warp allows "Fat DS":             Fat DS.
  6067. * OS/2, compatibility:                   Minimum.
  6068. * OS/2, floating point emulation:        OS/2 emulation.
  6069. * OS/2, incompatibilities:               OS/2.
  6070. * PMODE/DJ reduces interrupt reflection overhead: HW Int pitfalls.
  6071. * PMODE/DJ, can be used to produce stand-alone programs: Distributing.
  6072. * QDPMI allows "Fat DS":                 Fat DS.
  6073. * QDPMI and _crt0_startup_flags settings: QDPMI VM.
  6074. * QDPMI crashes debugger:                Old QDPMI.
  6075. * QDPMI crashes DJGPP programs when they cause Int 24h: Int 24h.
  6076. * QDPMI crashes Info:                    Buggy DPMI.
  6077. * QDPMI fails to provide virtual memory: QDPMI VM.
  6078. * QDPMI, how to disable:                 Old QDPMI.
  6079. * QDPMI, malloc/calloc failure:          QDPMI alloc.
  6080. * QDPMI, memory usage for nested programs: Swap out.
  6081. * QEMM crashes debugger:                 Old QDPMI.
  6082. * QEMM, auto/off mode, conflicts with CWSDPMI: QEMM AUTO.
  6083. * QEMM386, settings for optimal performance: Config.
  6084. * RCS port to DJGPP:                     Samples.
  6085. * REDIR, redirecting GCC messages to a file: Redirect.
  6086. * REDIR, redirecting stack dump to a file: Crash traceback.
  6087. * REDIR, use to get redirection and long command lines: Makefiles.
  6088. * regex package from GNU:                Unresolved externals.
  6089. * Regex.h, GCC can't find:               Missing C++ headers.
  6090. * RHIDE, development environment for DJGPP: Samples.
  6091. * RSX extender:                          Windows apps.
  6092. * RSXNT toolkit for developing Win32 applications: Windows apps.
  6093. * RSXWDK2 Windows development kit:       Windows apps.
  6094. * sbrk algorithm and QDPMI:              QDPMI VM.
  6095. * sbrk, Unix-like algorithm is incompatible with HW interrupts: HW Int pitfalls.
  6096. * SCRIPT, redirecting GCC messages to a file: Redirect.
  6097. * Sed requires floating point:           Changing.
  6098. * Sed script to convert ASM to AT&T syntax: Converting ASM.
  6099. * Sed, documentation:                    Can't find docs.
  6100. * sizeof, result when called on a structure: Struct size.
  6101. * stdiostream.h, GCC can't find:         Missing C++ headers.
  6102. * streambuf.h, GCC can't find:           Missing C++ headers.
  6103. * STRIP makes executables smaller:       Large executable.
  6104. * STUBEDIT, changing stack size:         Stack size.
  6105. * STUBEDIT, effect on memory left to spawned programs: Swap out.
  6106. * STUBIFY fails to produce .EXE under Novell: No EXE.
  6107. * STUBIFY.EXE, infected by a virus:      Unknown filetype.
  6108. * SYMIFY, a program to read crash traceback: Crash traceback.
  6109. * TA2AS, a converter from Intel to AT&T assembly syntax: Converting ASM.
  6110. * TeX, printing the docs:                Printed docs.
  6111. * TEXI2PS, converting docs to crude PostScript: Printed docs.
  6112. * UNIVBE, software VESA 2.0 emulation:   Which driver.
  6113. * Warp, compatibility:                   Minimum.
  6114. * Warp, incompatibilities:               OS/2.
  6115. * Win/NT doesn't allow "Fat DS":         Fat DS.
  6116. * Win/NT doesn't allow port I/O:         Windows/NT.
  6117. * Win95 long filenames and C++ headers:  Missing C++ headers.
  6118. * Win95, setting DJGPP environment variable: Missing headers/libraries.
  6119. * Windows 3.x allows "Fat DS":           Fat DS.
  6120. * Windows 3.x, compatibility:            Minimum.
  6121. * Windows 3.x, malloc/calloc fails:      Windows alloc.
  6122. * Windows 95 doesn't allow more than 16MB virtual memory: Win9x alloc.
  6123. * Windows 95, shortcut files conflict with ld: Win95 LNK files.
  6124. * Windows 9x allows "Fat DS":            Fat DS.
  6125. * Windows 9x, compatibility:             Minimum.
  6126. * Windows applications, writing with EMX/GCC: Windows apps.
  6127. * Windows messes up graphics screen:     GRX and Windows.
  6128. * Windows, malloc/calloc failure:        QDPMI alloc.
  6129. * Windows, memory usage for nested programs: Swap out.
  6130. * Windows, setting memory parameters for DJGPP: Config.
  6131. * Windows, stack size control:           Stack size.
  6132. * windows.h header file, where to get it: Windows apps.
  6133. * Windows/NT, compatibility:             Minimum.
  6134. * WinNT, setting DJGPP environment variable: Missing headers/libraries.
  6135. * WMEMU causes undefined references when linking: Emulation.
  6136. * WMEMU, an alternative floating-point emulator: Emulation.
  6137. * WMEMU, use when debugging FP programs on non-FPU machine: Debugging woes.
  6138. * Yacc, debugging generated code:        Included source.
  6139. Tag Table:
  6140. Node: Top
  6141. Node: Urgent
  6142. Node: DJGPP
  6143. Node: Requirements
  6144. Node: Minimum
  6145. Node: OS/2
  6146. Node: Windows/NT
  6147. 11362
  6148. Node: DOSEmu
  6149. 13245
  6150. Node: i286
  6151. 14868
  6152. Node: Windows apps
  6153. 15303
  6154. Node: Optimal hardware
  6155. 20106
  6156. Node: Reasonable hardware
  6157. 21130
  6158. Node: Config
  6159. 22160
  6160. Node: Getting DJGPP
  6161. 27521
  6162. Node: Where to find
  6163. 28262
  6164. Node: CCT
  6165. 35782
  6166. Node: How to download
  6167. 39458
  6168. Node: DJGPP by WWW
  6169. 40087
  6170. Node: What to download
  6171. 41540
  6172. Node: What to download-Footnotes
  6173. 46334
  6174. Node: Disk space
  6175. 46596
  6176. Node: DJGPP = Fatware
  6177. 48782
  6178. Node: Docs
  6179. 50698
  6180. Node: Where is the docs
  6181. 51430
  6182. Node: No Info
  6183. 52567
  6184. Node: Printed docs
  6185. 54398
  6186. Node: Ready PS
  6187. 56086
  6188. Node: Can't find docs
  6189. 57553
  6190. Node: Man pages
  6191. 57978
  6192. Node: Last resort
  6193. 61488
  6194. Node: Trouble
  6195. 61858
  6196. Node: No DPMI
  6197. 63242
  6198. Node: Buggy DPMI
  6199. 63768
  6200. Node: GCC optimizations
  6201. 65713
  6202. Node: Fatal signal
  6203. 68505
  6204. Node: Unknown filetype
  6205. 71105
  6206. Node: QEMM AUTO
  6207. 72093
  6208. Node: Make hangs
  6209. 73497
  6210. Node: Info can't find "Top"
  6211. 75299
  6212. Node: General trouble
  6213. 76711
  6214. Node: Redirect
  6215. 77869
  6216. Node: Deja vu
  6217. 79457
  6218. Node: Totally lost
  6219. 82660
  6220. Node: Compiler performance
  6221. 84883
  6222. Node: Slow compiler
  6223. 85586
  6224. Node: Slow linker
  6225. 90071
  6226. Node: Compiling
  6227. 92411
  6228. Node: Missing headers/libraries
  6229. 94279
  6230. Node: Missing headers/libraries-Footnotes
  6231. 100528
  6232. Node: Missing C++ headers
  6233. 100711
  6234. Node: C++ comments
  6235. 104130
  6236. Node: Which language
  6237. 106661
  6238. Node: Objective C
  6239. 108752
  6240. Node: DJGPP-specific
  6241. 109452
  6242. Node: Unresolved externals
  6243. 110634
  6244. Node: Which library
  6245. 112318
  6246. Node: Libraries' order
  6247. 114614
  6248. Node: Still unresolved
  6249. 116442
  6250. Node: Class Complex
  6251. 117028
  6252. Node: Pure virtual
  6253. 118831
  6254. Node: djgpp_first_ctor
  6255. 119961
  6256. Node: Large image
  6257. 121344
  6258. Node: Large executable
  6259. 122405
  6260. Node: Win95 LNK files
  6261. 125316
  6262. Node: No EXE
  6263. 125917
  6264. Node: Large object files
  6265. 127837
  6266. Node: Running
  6267. 128754
  6268. Node: v2.x crash
  6269. 129388
  6270. Node: Crash traceback
  6271. 131869
  6272. Node: File data corrupted
  6273. 134575
  6274. Node: Screen I/O
  6275. 135449
  6276. Node: Distributing
  6277. 137556
  6278. Node: Graphics
  6279. 139187
  6280. Node: Which driver
  6281. 139809
  6282. Node: Direct access
  6283. 141129
  6284. Node: GRX and Windows
  6285. 142851
  6286. Node: Floating point
  6287. 144050
  6288. Node: Emulation
  6289. 144797
  6290. Node: Other emulators
  6291. 147186
  6292. Node: OS/2 emulation
  6293. 147772
  6294. Node: -msoft-float
  6295. 148321
  6296. Node: Numeric exceptions
  6297. 148940
  6298. Node: Emulator accuracy
  6299. 150035
  6300. Node: SIGFPE with ObjC
  6301. 151006
  6302. Node: SIGFPE in ldexp
  6303. 151873
  6304. Node: Debugging
  6305. 152765
  6306. Node: How to debug
  6307. 153670
  6308. Node: Old QDPMI
  6309. 158061
  6310. Node: GDB needs COFF
  6311. 158775
  6312. Node: Transfer buffer
  6313. 159664
  6314. Node: Debug graphics
  6315. 160678
  6316. Node: GDB and C++ source
  6317. 162463
  6318. Node: C++ classes in GDB
  6319. 163428
  6320. Node: Included source
  6321. 164446
  6322. Node: Debugging woes
  6323. 165575
  6324. Node: Profiling
  6325. 167681
  6326. Node: How to profile
  6327. 168281
  6328. Node: Gprof needs COFF
  6329. 168936
  6330. Node: Gprof docs
  6331. 169585
  6332. Node: I/O bound programs
  6333. 170107
  6334. Node: No profile
  6335. 170796
  6336. Node: No profile-Footnotes
  6337. 172538
  6338. Node: Performance
  6339. 172789
  6340. Node: How fast
  6341. 173376
  6342. Node: Faster v1
  6343. 174255
  6344. Node: Pentium
  6345. 175093
  6346. Node: I/O speed
  6347. 176158
  6348. Node: Slow-down
  6349. 177728
  6350. Node: Memory
  6351. 180016
  6352. Node: How much memory
  6353. 180836
  6354. Node: Confusing alloc
  6355. 182113
  6356. Node: QDPMI VM
  6357. 183214
  6358. Node: QDPMI alloc
  6359. 185084
  6360. Node: Windows alloc
  6361. 186990
  6362. Node: Win9x alloc
  6363. 187845
  6364. Node: EMM386 alloc
  6365. 188703
  6366. Node: Swap out
  6367. 189864
  6368. Node: Stack size
  6369. 191926
  6370. Node: Command line
  6371. 196012
  6372. Node: Filename globbing
  6373. 196850
  6374. Node: Disable globbing
  6375. 199151
  6376. Node: Special chars
  6377. 199934
  6378. Node: Long commands
  6379. 201706
  6380. Node: Long commands-Footnotes
  6381. 203827
  6382. Node: How long
  6383. 204135
  6384. Node: Makefiles
  6385. 205659
  6386. Node: Converting
  6387. 206849
  6388. Node: Syntax
  6389. 207565
  6390. Node: Gas bugs
  6391. 210948
  6392. Node: Converting ASM
  6393. 212374
  6394. Node: Converting ASM-Footnotes
  6395. 214397
  6396. Node: ASM GPF
  6397. 214624
  6398. Node: OBJ and LIB
  6399. 216047
  6400. Node: OBJ and LIB-Footnotes
  6401. 218897
  6402. Node: 16-bit code
  6403. 219093
  6404. Node: NEAR and FAR
  6405. 220437
  6406. Node: Low-level
  6407. 222294
  6408. Node: int86
  6409. 223501
  6410. Node: Pointer segment
  6411. 225081
  6412. Node: Zero SP
  6413. 227571
  6414. Node: Zero SP-Footnotes
  6415. 229272
  6416. Node: Xfer
  6417. 229524
  6418. Node: 20 bits
  6419. 233184
  6420. Node: Fat DS
  6421. 234165
  6422. Node: Above 1MB
  6423. 237863
  6424. Node: RMCB
  6425. 238801
  6426. Node: Hardware interrupts
  6427. 239816
  6428. Node: _go32 vs __dpmi
  6429. 247013
  6430. Node: HW Int pitfalls
  6431. 248761
  6432. Node: Ports
  6433. 252470
  6434. Node: Inline Asm
  6435. 253183
  6436. Node: Legalese
  6437. 254523
  6438. Node: Applications
  6439. 254891
  6440. Node: Redistribution
  6441. 258005
  6442. Node: Help
  6443. 260919
  6444. Node: DJGPP isn't GNU
  6445. 261616
  6446. Node: Mailing list
  6447. 262505
  6448. Node: Subscribing
  6449. 262989
  6450. Node: Unsubscribing
  6451. 265413
  6452. Node: Silent list
  6453. 267228
  6454. Node: Duplicates
  6455. 268600
  6456. Node: Newsgroup
  6457. 270437
  6458. Node: v2
  6459. 271426
  6460. Node: New and improved
  6461. 271821
  6462. Node: Environment
  6463. 273130
  6464. Node: Miscellany
  6465. 275291
  6466. Node: Changing
  6467. 276491
  6468. Node: Samples
  6469. 279990
  6470. Node: Symlinks
  6471. 287840
  6472. Node: DPMI Spec
  6473. 289108
  6474. Node: WWW
  6475. 290205
  6476. Node: Upload
  6477. 291056
  6478. Node: Cross-DJGPP
  6479. 293465
  6480. Node: 0xfe+0x20
  6481. 296856
  6482. Node: Struct size
  6483. 297763
  6484. Node: Struct size-Footnotes
  6485. 301765
  6486. Node: Struct packing
  6487. 301914
  6488. Node: Int 24h
  6489. 302636
  6490. Node: go32-v2
  6491. 305104
  6492. Node: DXE
  6493. 305983
  6494. Node: LFN
  6495. 307308
  6496. Node: Missing separator
  6497. 308950
  6498. Node: Zoneinfo
  6499. 309992
  6500. Node: FAQ format
  6501. 313279
  6502. Node: About
  6503. 316086
  6504. Node: Topic Index
  6505. 318784
  6506. Node: Program Index
  6507. 357746
  6508. End Tag Table
  6509.