home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
FAQ202B.ZIP
/
FAQ202B.EXE
/
info
/
djgppfaq.info
(
.txt
)
Wrap
GNU Info File
|
1996-10-16
|
378KB
|
6,509 lines
This is Info file djgppfaq.info, produced by Makeinfo version 1.67 from the
input file djgppfaq.num.
START-INFO-DIR-ENTRY
* FAQ: (djgppfaq). The DJGPP FAQ list.
END-INFO-DIR-ENTRY
This is the DJGPP Frequently-Asked Questions List.
Copyright (C) 1994, 1995, 1996 Eli Zaretskii
This is the second edition of the FAQ list,
and is consistent with version 2.0 of DJGPP.
This FAQ list may be freely distributed with the DJGPP package or any part
thereof, provided this copyright notice is left intact on all copies.
File: djgppfaq.info, Node: Top, Next: Urgent, Prev: (dir), Up: (dir)
DJGPP FAQ List
**************
In DJGPP (*note DJGPP overview: DJGPP.), a 32-bit compiler and programming
environment, originally written for Unix machines, meet a 16-bit MS-DOS
operating system. Programmers who work in this environment have to master a
large body of knowledge from both Unix and MS-DOS, especially if they want to
use some advanced features, like interrupt handling, directly accessing
peripheral devices, etc.
But because the DJGPP project is a product of a group of volunteers, there
isn't always enough time (or patience, or money ;-) to produce documentation
which will describe all the subtle features and pitfalls a user should know
about. The documentation of DJGPP-specific utilities and issues is therefore
minimal, leaving wide space for confusion, in newcomers and veterans alike,
and making the DJGPP learning curve quite a steep one.
This FAQ list is an attempt to take the sting out of that learning curve, by
supplying solutions for problems which are known to puzzle DJGPP users.
(Another solution would be to pay to DJ Delorie and other people who
developed DJGPP to produce more documentation ;-).
This is Edition 2.02 of the FAQ, last updated 16 October 1996, for DJGPP
Version 2.0.
Another place to look for DJGPP documentation is the DJGPP Knowledge Base, at
this URL:
http://www.delorie.com/djgpp/doc/kb/
Brennan Underwood <brennan@mack.rt66.com> maintains a home page which is
another valuable source for information about DJGPP, at this URL:
http://brennan.home.ml.org/djgpp
You can browse the HTML version of this FAQ list on line at the DJ Delorie's
Web server, at this URL:
http://www.delorie.com/djgpp/v2faq/faq.html
If you browse this FAQ at DJ Delorie's server now, you can get the source
distribution of the FAQ right here, at this URL:
http://www.delorie.com/djgpp/v2faq/faq202s.zip
Also available from the DJ's server: FAQ in all the supported formats, at
this URL:
http://www.delorie.com/djgpp/v2faq/faq202b.zip
A previous version of this FAQ was translated into French, e.g.
ftp://ftp.delorie.com/pub/djgpp/v2faq/frfaq.zip, also available through the
WWW, at this URL:
http://www.delorie.com/djgpp/v2faq/frfaq.zip
The following master menu lists the major topics in this FAQ list, including
all the indices.
* Menu:
* Urgent:: If you are in a hurry.
* DJGPP:: What is DJGPP?
* Requirements:: Hardware and software requirements for DJGPP.
* Getting DJGPP:: Where and what to download?
* Docs:: Where the documentation is and how to read it.
* Trouble:: When the compiler (or Make, or Info, or ...) crashes
* Compiler performance:: How fast is the compiler?
* Compiling:: Compile-time and link-time problems.
* Running:: Running compiled programs.
* Graphics:: Graphics under DJGPP.
* Floating point:: Floating-point programs and FP emulation.
* Debugging:: Debugging DJGPP programs.
* Profiling:: Optimizing your programs.
* Performance:: Run-time performance of DJGPP programs.
* Memory:: Run-time memory issues.
* Command line:: Command-line arguments handling in DJGPP.
* Converting:: How to convert DOS code to DJGPP?
* Low-level:: Low-level and hardware-oriented programming.
* Legalese:: Legal aspects of programming with DJGPP.
* Help:: How to get more help.
* v2:: New in DJGPP Version 2.0.
* Miscellany:: More...
* About:: Contributors to this FAQ.
* Topic Index:: Search here by a problem description.
* Program Index:: Search here by a program name.
File: djgppfaq.info, Node: Urgent, Next: DJGPP, Prev: Top, Up: Top
1. If You Are In a Hurry
************************
**Q*: Do you really mean I have to read this looongish FAQ list to get my
answers?*
**Q*: I have this problem which I absolutely MUST solve NOW! What do I do?*
*A* : No, you don't need to read *all* of the FAQ unless you want to
(although this is by all means recommended). The questions in this document
are listed, as much as possible, in the order they appear when one goes
through getting DJGPP, installing it and using it. To quickly find an answer
to your question, first look at the *Note Table of Contents: Top. If that
doesn't help, try the indices at the end of this manual. You can either look
up your question *Note by program name: Program Index, or *Note by topic
name: Topic Index. If you don't find anything appropriate, search this FAQ
for words which are pertinent to your problem. For those in a *real* hurry,
here are some pointers to the most important topics in this FAQ list:
* How to ask experienced DJGPP users for help?
Use the DJGPP News group or mailing list. For most questions, you will
have your answer in a day or two. *Note the details on how to ask the
gurus: Totally lost.
* What is the best configuration of my system for DJGPP?
This depends on your hardware and software. *Note system configuration
guidelines: Config.
* Some files I need seem to be missing. Where do I find them?
Check out the *Note list of required and optional packages: What to
download.
* How do I subscribe to or unsubscribe from the DJGPP mailing list?
*Note subscription instructions: Subscribing.
* How can I search News group/mailing list traffic for some info?
This FAQ includes the *Note description of DJGPP archive search servers:
Deja vu, set up by Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp>
and DJ Delorie <dj@delorie.com>.
File: djgppfaq.info, Node: DJGPP, Next: Requirements, Prev: Urgent, Up: Top
2. What is DJGPP?
*****************
**Q*: What is DJGPP?*
*A* : DJGPP is a port of GNU C/C++ compiler and development tools to 32-bit,
protected-mode environment on Intel 32-bit CPUs running MS-DOS and compatible
operating systems, by DJ Delorie <dj@delorie.com> and friends. Starting from
v2.0, DJGPP programs do not need a separate extender program, only a DPMI
server to run; DJGPP includes a free 32-bit DPMI server which allows for a
32-bit, 4 GByte flat address space and up to 256 MBytes of virtual memory, a
compiler which produces 32-bit protected-mode code, and a suite of GNU
development tools ported to MS-DOS. These provide for a development
environment which specifically favors porting Unix programs, but is also
suitable for writing new code. With a few exceptions (notably, the C++ class
library), DJGPP is *free* which makes it ideal for developing free and
commercial software alike.
DJ Delorie <dj@delorie.com> is the developer and principal maintainer of
DJGPP, but anyone is welcome and encouraged to contribute.
File: djgppfaq.info, Node: Requirements, Next: Getting DJGPP, Prev: DJGPP, Up: Top
3. Hardware and Software Requirements
**************************************
This chapter describes what are the hardware and software which will allow
you to use DJGPP. Minimum, "reasonable" and optimal system configurations
are listed.
* Menu:
* Minimum:: You cannot run DJGPP unless you have this.
* OS/2:: But it crashes under OS/2!
* Windows/NT:: Is it compatible with Win/NT?
* DOSEmu:: Can I run it on Linux?
* i286:: Why not?
* Windows apps:: Can I write Windows applications with DJGPP?
* Optimal hardware:: Here is your dream machine description.
* Reasonable hardware:: For the rest of us.
* Config:: How best to configure your system software.
File: djgppfaq.info, Node: Minimum, Next: OS/2, Prev: Requirements, Up: Requirements
3.1 The minimum system requirements for using DJGPP
===================================================
**Q*: What are the minimum system requirements for using DJGPP?*
**Q*: Will DJGPP run on my brand-new Acme i986DX7/300 PC with a SCSI-III
10-Terabyte disk drive under MulticOS/42 v7.99 operating system?*
*A* : DJGPP requires at least 386SX CPU and between 15 and 35 MB of free
disk space (*note more details on this below: Disk space.), including space
for the software installation and some swap space. A minimum of 64K of
system memory is enough for DJGPP to run with the CWSDPMI free DPMI host
(most other DPMI hosts will require much more), but at least 2.5MB of free
extended RAM is recommended for reasonably fast compilation of large source
files (4MB for compiling large C++ programs); you might see painfully slow
compiles for large sources if you don't have at least that much. If your
machine doesn't have a numeric co-processor, you will need to install an
emulator to run floating-point code (DJGPP provides such an emulator) or link
your applications with a special emulator library (also provided with DJGPP).
DJGPP will run under native DOS; any other operating system is OK if it
includes a DPMI server. Environments known to run DJGPP besides native DOS:
Windows 3.1 & 3.11 DOS box, OS/2 (including Warp) DOS box, Windows 95/DOS 7,
Novell NWDOS 7.x (but several people have found the DPMI services of NWDOS
buggy, so they should probably be turned off and CWSDPMI used instead), and
Linux DOSEmu environment.
File: djgppfaq.info, Node: OS/2, Next: Windows/NT, Prev: Minimum, Up: Requirements
3.2 Does it really work under OS/2?
===================================
**Q*: You tell me it will work under OS/2, but I'm experiencing strange
crashes after several compilations ...*
**Q*: DJGPP Make crashes when I run it on OS/2!*
*A* : There was a bug in the DPMI server of the old OS/2 versions, which is
triggered by spawning child processes (like GCC does when it invokes the
various compiler passes). Current versions of OS/2 don't have that bug, so
DJGPP programs should run fine under OS/2. If you can't make this happen,
chances are that your setup is incorrect. One system parameter that can
cause problems with DJGPP (reportedly, Make crashes if it isn't set
correctly) is `DPMI_DOS_API.' Setting it to `ENABLED' instead of the default
`AUTO' should solve the problem. I'm also told that experimenting with the
value of `DPMI_MEMORY_LIMIT' sometimes solves problems on OS/2.
If the above doesn't help, please post the details of the crashes you see to
the DJGPP News group (*note description of the DJGPP news group: Newsgroup.)
or mailing list (*note how to post to the mailing list: Mailing list.), and
somebody will help you.
One thing that you should remember when you run DJGPP on OS/2 is to set the
`DOS_DPMI_INTERFACE' to "Enabled" instead of "Auto" in the DOS session
settings' box.
File: djgppfaq.info, Node: Windows/NT, Next: DOSEmu, Prev: OS/2, Up: Requirements
3.3 Will it work under Windows/NT?
==================================
**Q*: What about Windows NT?*
*A* : Current Windows NT versions support DPMI programs in the DOS box, so
DJGPP programs should run fine under NT. Therefore, beginning with DJGPP
v2.0, the distribution doesn't include real-mode `gcc.exe' anymore, as it is
not needed.
Note that the long filename API for DOS box is not supported by current
versions of Win/NT, so you cannot have long filenames there. (There is a
rumor that the new version 4.0 of WinNT will support the LFN API, but I'm
told that at least the current beta versions still don't.)
You might have problems with using the SVGA modes of your video card under
Win/NT. That is because NT doesn't allow direct access to the SVGA
registers, without which it is impossible to recognize the type of the SVGA
and employ its capabilities. For example, a user reported that GRX functions
and the `MODETEST.EXE' program thought that only a standard VGA was
installed, whereas he had an S3 card. There is nothing you can do about this
feature of Win/NT; that is the price you pay for the stability and protection
you get under this OS (a runaway program that accesses hardware registers can
wipe out your disk or wedge the entire system cold). However, I'm told that
Win/NT 4.0 will support "DirectX" which is a method of accessing screen,
audio and other peripherals directly, so it's possible to use full GRX
graphics capabilities there.
The Cygnus Win32 project is another port of GCC and development tools to
WinNT and Win95 platforms, which specifically targets development of Windows
programs. It is available from the Cygnus archives, e.g.
ftp://ftp.cygnus.com/pub/sac/win32/ or through the Web, at this URL:
http://www.cygnus.com/misc/gnu-win32/
File: djgppfaq.info, Node: DOSEmu, Next: i286, Prev: Windows/NT, Up: Requirements
3.4 Can it run under Linux?
===========================
**Q*: You say it works on Linux, but I cannot seem to run the compiler from
within Make...*
**Q*: I can run DJGPP on Linux, but Make crashes with SIGFPE on even the
simplest Makefiles!*
*A* : Versions of Linux which were released before 13 March 1996 need a
patch to be able to reliably run nested DJGPP programs. That patch was
posted to the DJGPP mailing list and is available from the DJGPP mail
archives, at this URL:
http://www.delorie.com/djgpp/mail-archives/djgpp/1996/02/26/13:28:52
If you prefer to download that patch via ftp, you can find it on the DJGPP
ftp server, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/dpmi-dosemu-djgpp.mail.
You might also need to edit the RAM section of the `dosemu.conf' file to make
it comfortable for DJGPP. I suggest setting `dpmi' and `xms' to 16MB and
`ems' to 4MB.
Some users reported that `Make', and possibly other programs which use
floating point computations, crash in DOSEmu environment on systems without
an FPU, even if you set the 387 and EMU387 environment variables correctly
(as explained in *Note Setting up the FP emulator: Emulation, below). The
only known work-around is to not use floating point or to upgrade your
machine hardware. It is possible that newer versions of Linux might solve
this problem too, so try upgrading your Linux software.
If your only problem is to run GNU Make, get the latest DJGPP port of Make,
since latest ports can be configured to not issue FP instructions at all.
File: djgppfaq.info, Node: i286, Next: Windows apps, Prev: DOSEmu, Up: Requirements
3.5 Can I run it on a 286?
==========================
**Q*: Why can't I run DJGPP on my 286? It has protected mode also...*
*A* : True, but the protected mode isn't an issue here. Gcc doesn't care
much about memory protection, but it does care to run on a 32-bit processor,
which the 286 isn't. A 386 or better CPU really *is* required.
File: djgppfaq.info, Node: Windows apps, Next: Optimal hardware, Prev: i286, Up: Requirements
3.6 MS-Windows applications and DJGPP
=====================================
**Q*: Can I write MS-Windows applications with DJGPP?*
*A* : Currently, you can only run DJGPP programs under Windows as DOS apps
(i.e. inside DOS Box). If you need to write true Windows apps, try using the
RSX extender with EMX port of GCC and RSXWDK kit for Windows. You can get
RSX by anonymous ftp, e.g.
ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc/. People who tried this
report that you must download and unzip the RSXWDK2 source archive, not only
the binaries (otherwise you'll get General Protection Faults when you try to
run DJGPP programs). If you cannot reach the above site (some people say
that it has closed its anonymous access), try looking on an alternative site,
e.g. ftp://hermes.hrz.uni-bielefeld.de/pub/systems/msdos/misc/. Other
locations to look are RSXWDK on Cica mirrors, e.g.
ftp://ftp.winsite.com/pub/pc/win3/programr/rsxwdk2s.zip, or RSXWDK on any of
the TeX Archive Network sites, e.g.
ftp://ftp.shsu.edu/tex-archive/systems/msdos/dpmigcc/.
Another problem with RSXWDK is that the Makefiles there are written for
`ndmake', so they should be rewritten for GNU Make to work. Some more
hacking of Makefiles might be required due to the fact that they are set to
work with EMX, and assume you unpacked everything into `/rsxwdk.' You will
also have to recompile the libraries as they were compiled with DJGPP v1.x,
and hack the v2 startup file `crt0.s' along the same lines as the v1 version
which comes with RSXWDK. (`crt0.s' comes with the DJGPP source distribution,
`djlsr200.zip'.)
Apart from RSXWDK, you will need a `windows.h' header file. One place to
find it is with the WINE distribution, e.g.
ftp://ftp.cdrom.com/pub/FreeBSD/distfiles/ (you'll have to add -DWINELIB to
CFLAGS when compiling). However, be warned that this is a complete rewrite
of the original, and might produce error messages when used to compile
Windows apps. I don't know about a better solution except using `windows.h'
from a commercial compiler, which might get you into legal trouble.
You will also need a help compiler, e.g.
ftp://ftp.aiai.ed.ac.uk/pub/packages/tex2rtf/rtfutils/hcp505.zip, or try at
the Microsoft ftp site, e.g.
ftp://ftp.microsoft.com/Softlib/MSFILES/HC305.EXE. I'm told that, legally,
you must already have purchased a help compiler from Microsoft to use either
one of these.
A resource compiler is also required. RSXNT (below) includes one such, but I
didn't yet hear any success stories using it. Anybody?
Note that, according RSXWDK's author, that package is meant for those who
already have working debugged Windows applications and are simply looking to
port them to 32-bit code. Therefore, some crucial parts of a development
environment (like a debugger) are missing there. The author of RSX has
recently discontinued his support of the package and switched to RSXNT
project that targets Win32 (Win9x and WinNT) platforms (below).
As of this writing, nobody has reported any first-hand experience of using
RSXWDK with DJGPP v2.0; the above is based on user reports under v1.x. If
you try RSXWDK with v2.0, please post a summary of your experience.
There is also a newer Windows development tool-chain by the author of RSXWDK
called RSXNT. This is targeted for Win32 platforms (Win95 and WinNT) and
does have debugging tools included, but it needs to be registered if you want
to develop commercial or shareware applications with it. It can be found on
the same sites as RSXWDK and comes with header files from Cygnus. You can
find the DJGPP-specific version of RSXNT on SimTel mirrors, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/rsxntdj1.zip. The sources
of all the RSXNT utilities can be found in `rsxnt1.zip' archive on Cica
mirrors, in the `win95/programr/' directory. Note that currently, due to
limitations of DJGPP, you cannot produce DLLs or programs that will run on
Win32s platforms with RSXNT.
Another way to develop Windows applications is to use the Cygnus GCC/GPP
port, at this URL:
http://www.cygnus.com/gnu-win32/
You can also download it via anonymous ftp, e.g.
ftp://ftp.cygnus.com/pub/sac/win32/. This one's compatible with Win32 (Win95
or WinNT, not Win32s), but requires you to comply with the GNU Copyleft
system. The Cygnus distribution includes development environments which run
on WinNT and Linux, targeting WinNT and Win95 platforms. Note that, as of
this writing, the Cygnus port is still in early beta phase, and some nasty
bugs are bound to be there. Contact Steve Chamberlain <sac@rtl.cygnus.com>,
for more details.
A better (but harder) way would be to volunteer to add Windows support to
DJGPP.
File: djgppfaq.info, Node: Optimal hardware, Next: Reasonable hardware, Prev: Windows apps, Up: Requirements
3.7 What you *should* buy ...
=============================
**Q*: What is the optimal system configuration for running DJGPP?*
*A* : Here is the description of your dream machine (at least for the next 6
months :-):
* Hardware:
- the fastest CPU you can find (a 200 MHz Pentium-Pro as of this
writing);
- at least 512KB second-level (off-chip) cache memory;
- 128 MByte RAM;
- motherboard built around fast 32-bit-wide bus (VLB or PCI);
- SCSI-II hard disk with bus-mastering controller;
* Software:
- DOS, device drivers and TSRs all loaded HIGH, leaving only 5K DOS
footprint in lower (under 640K) memory;
- 8 MByte RAM disk installed, `TMPDIR' environment variable points to
it (e.g., `set TMPDIR=e:', if E: is the RAM drive letter);
- 8 MByte of disk cache, set to delayed-write operation;
File: djgppfaq.info, Node: Reasonable hardware, Next: Config, Prev: Optimal hardware, Up: Requirements
3.8 What most of us will *actually* buy ...
===========================================
**Q*: OK, I don't have this much money. What is the *reasonable*
configuration?*
*A* : If you have the following machine, you should be able to stop worrying
about memory and compilation performance:
- CPU: 486DX2-66 with 256 KB off-chip cache;
- RAM: 16 MByte;
- Disk: 12 ms IDE with VLB controller, or SCSI;
- 4 MByte RAM disk;
- 3 MByte disk cache;
This will leave you with about 8 MBytes of free extended RAM. Note that the
RAM disk must be 4 MBytes to hold the output of the preprocessor for some
exceedingly large source files (notably, some GCC source files). If you
don't have that much RAM to spare and still want to compile *very* large
source files, either reduce the disk cache so you can give more to RAM disk,
or point `TMPDIR' to your hard disk and make the disk cache larger, if you
File: djgppfaq.info, Node: Config, Prev: Reasonable hardware, Up: Requirements
3.9 How to configure your system for DJGPP?
===========================================
**Q*: How do I configure my system to get optimal performance under DJGPP?*
*A* : That depends on the amount of RAM you have installed in your machine.
Below are some guidelines to help you.
a. If you have 2 MBytes or less RAM installed:
* Don't use *any* memory manager.
* Use of `CWSDPMI' as your DPMI host is highly recommended.
* Remove any TSR and device drivers you don't absolutely need (like
`SETVER.EXE', `HIMEM.SYS' etc.) from your `CONFIG.SYS' and
`AUTOEXEC.BAT.'
* Do *not* install disk cache or RAM disk; point your `TMPDIR'
environment variable to a directory on your hard disk. Put a
sufficiently large `BUFFERS=' statement into your `CONFIG.SYS' (I
recommend setting `BUFFERS=40,8') to make DOS file operations
faster.
* If you use `CWSDPMI' as your DPMI host, get the `CWSPARAM' program
(from the `csdpmi3p.zip' archive) and set the "Minimum application
memory desired before 640K paging" parameter to 512K or larger.
(Depending on how much memory you actually have, you might need to
further fine-tune this parameter. This parameter defines the
lowest amount of extended memory CWSDPMI will use; if your system
doesn't have that much free extended RAM, CWSDPMI will use
conventional memory instead, where usually there should be around
600K of free RAM.)
* If you run under Windows, be sure to set the maximum amount of
extended memory on your PIF file for the DOS box to a reasonable
value.
With this configuration, GCC will run out of free physical RAM and page
when compiling almost any C program and all C++ programs. If you are
serious about DJGPP development, you need to buy more RAM *urgently*.
b. If you have 2-4 MBytes of RAM installed:
* Don't use *any* memory manager.
* Remove any TSR and device driver you don't absolutely need (like
`SETVER.EXE', `HIMEM.SYS') from your `CONFIG.SYS' and
`AUTOEXEC.BAT.'
* Get a disk cache which works from conventional memory and configure
it to 256K size at most, or don't use a cache at all.
* Do *not* install a RAM disk; point your `TMPDIR' environment
variable to a directory on your hard disk.
* If you run under Windows, be sure to set the maximum amount of
extended memory on your PIF file for the DOS box to a reasonable
value.
With this configuration, GCC will still run out of free physical RAM and
page when compiling large C programs and most C++ programs. Plan to buy
more RAM as soon as you can.
c. If you have 5-8 MBytes of RAM installed:
* Use a memory manager such as EMM386 or QEMM386. Try using the
FRAME=NONE parameter of the memory manager. This will disable
Expanded Memory (EMS) services as far as most programs are
concerned; if you must use DJGPP together with any program which
needs EMS, try to configure that program to use Extended Memory
(XMS) instead.
* Load DOS, device drivers and TSRs *HIGH*.
* Give your disk cache 1 MByte of RAM. Enable its delayed-write (aka
write-back) feature.
* Do *not* install a RAM disk; point your `TMPDIR' environment
variable to a directory on your hard disk.
* If, after configuring your system as above, you still have more
than 2.5 MBytes of free RAM left (4 MBytes, if you plan to program
in C++ a lot), enlarge the disk cache size.
* If you run under Windows, be sure to set the maximum amount of
extended memory on your PIF file for the DOS box to a reasonable
value.
d. If you have more than 8 MBytes of RAM:
* Use a memory manager to load DOS, TSRs and device drivers *HIGH*.
* Install at least a 2-MByte-large disk cache, configured to use the
delayed- write feature. If you have plenty of RAM, you can give
your cache as much as 8 MBytes of memory.
* If you have more than 5 MBytes left, install a RAM disk with a size
of at least 1.5 MBytes and point your `TMPDIR' environment variable
to it. If your RAM disk is less than 4 MBytes, GCC might run out
of space there for *very* large source files (e.g., cccp.c file
from the GCC source distribution), but this shouldn't happen unless
the size of the source file you are compiling approaches 1 MByte.
Some people disable the delayed-write feature for safety reasons, to avoid
losing files due to system crashes. In such cases, you can usually gain
performance without sacrificing safety by enabling delayed-write together
with an option that causes the cache to flush the write-behind data before
the system returns to the DOS prompt. For a `SmartDrv' disk cache, this is
achieved by specifying `/N/F' switches instead of `/X'.
A tutorial is available on how to set up and get started with DJGPP, at this
http://remus.rutgers.edu/~avly/djgpp.html
File: djgppfaq.info, Node: Getting DJGPP, Next: Docs, Prev: Requirements, Up: Top
4. Where and What to Download?
******************************
This chapter explains where and how can you get DJGPP, and recommends which
parts of the archive you should download.
* Menu:
* Where to find:: Pick up from your nearest SimTel mirror.
* CCT:: Or look on one of the CCT mirrors.
* How to download:: Anonymous FTP, of course!
* DJGPP by WWW:: For those who use Netscape/Mosaic only.
* What to download:: Look here to decide what packages you need.
* Disk space:: How much disk storage do you need?
* DJGPP = Fatware:: Can I do with less MBytes?
File: djgppfaq.info, Node: Where to find, Next: CCT, Prev: Getting DJGPP, Up: Getting DJGPP
4.1 Where can I get DJGPP?
==========================
**Q*: Where can I get DJGPP?*
*A* : Look on any SimTel mirror in the pub/simtelnet/gnu/djgpp/ subdirectory.
Lately, there has been considerable confusion caused by the fact that the
repository which was long known by the name "SimTel" is no longer called
that; its new name is "CCT". The name SimTel has moved (along with its
originator and long-time manager, Keith Petersen <w8sdz@Simtel.Net>) to
another distribution network which uses almost the same ftp sites, but in
different subdirectories. The name SimTel is copyrighted by this new
distribution network, and so CCT will have to discontinue its use of that
name. Experience shows that SimTel (not CCT) is better managed and updates
propagate there much faster, so I advise you to try using SimTel mirrors
first, and fall back to CCT only if a SimTel site is unavailable to you.
This section lists the SimTel mirrors; see *Note below: CCT, for the list of
CCT sites.
The primary SimTel site is:
ftp.simtel.net, directory /pub/simtelnet/gnu/djgpp
Here is a list of hosts by countries that offer mirror sites:
Australia:
ftp.bhp.com.au, directory /pub/simtelnet/gnu/djgpp
Newcastle, Australia:
ftp.iniaccess.net.au, directory /pub/simtelnet/gnu/djgpp
Australia:
ftp.tas.gov.au, directory /pub/simtelnet/gnu/djgpp
Australia:
sunsite.anu.edu.au, directory /pub/simtelnet/gnu/djgpp
Austria:
ftp.univie.ac.at, directory /mirror/simtelnet/gnu/djgpp
Brussels, Belgium:
ftp.linkline.be, directory /mirror/simtelnet/gnu/djgpp
Aarshot, Belgium:
ftp.tornado.be, directory /pub/simtelnet/gnu/djgpp
Sao Paulo, Brazil:
ftp.unicamp.br, directory /pub/simtelnet/gnu/djgpp
Brazil:
ftp.iis.com.br, directory /pub/simtelnet/gnu/djgpp
Bulgaria:
ftp.eunet.bg, directory /pub/simtelnet/gnu/djgpp
Ottawa, Canada:
ftp.crc.doc.ca, directory /systems/ibmpc/simtelnet/gnu/djgpp
Vancouver, Canada:
ftp.direct.ca, directory /pub/simtelnet/gnu/djgpp
Chile:
sunsite.dcc.uchile.cl, directory /pub/Mirror/simtelnet/gnu/djgpp
Beijing, China:
ftp.pku.edu.cn, directory /pub/simtelnet/gnu/djgpp
Czech Republic:
ftp.eunet.cz, directory /pub/simtelnet/gnu/djgpp
Prague, Czech Republic:
pub.vse.cz, directory /pub/simtelnet/gnu/djgpp
Czech Republic:
ftp.zcu.cz, directory /pub/simtelnet/gnu/djgpp
Espoo, Finland:
ftp.funet.fi, directory /mirrors/ftp.simtel.net/pub/simtelnet/gnu/djgpp
Neuilly, France:
ftp.grolier.fr, directory /pub/simtelnet/gnu/djgpp
Paris, France:
ftp.ibp.fr, directory /pub/simtelnet/gnu/djgpp
Germany:
ftp.mpi-sb.mpg.de, directory /pub/simtelnet/gnu/djgpp
Bochum, Germany:
ftp.rz.ruhr-uni-bochum.de, directory /pub/simtelnet/gnu/djgpp
Chemnitz, Germany:
ftp.tu-chemnitz.de, directory /pub/simtelnet/gnu/djgpp
Heidelberg, Germany:
ftp.uni-heidelberg.de, directory /pub/simtelnet/gnu/djgpp
Magdeburg, Germany:
ftp.uni-magdeburg.de, directory /pub/simtelnet/gnu/djgpp
Paderborn, Germany:
ftp.uni-paderborn.de, directory /pub/simtelnet/gnu/djgpp
Trier, Germany:
ftp.uni-trier.de, directory /pub/pc/mirrors/simtelnet/gnu/djgpp
Wuerzburg, Germany:
ftp.rz.uni-wuerzburg.de, directory /pub/pc/simtelnet/gnu/djgpp
Athens, Greece:
ftp.ntua.gr, directory /pub/pc/simtelnet/gnu/djgpp
Hong Kong:
sunsite.ust.hk, directory /pub/simtelnet/gnu/djgpp
Hong Kong:
ftp.hkstar.com, directory /pub/simtelnet/gnu/djgpp
Hong Kong:
ftp.cs.cuhk.hk, directory /pub/simtelnet/gnu/djgpp
Jerusalem, Israel:
ftp.huji.ac.il, directory /pub/simtelnet/gnu/djgpp
Naples, Italy:
ftp.unina.it, directory /pub/simtelnet/gnu/djgpp
Italy:
cis.utovrm.it, directory /simtelnet/gnu/djgpp
Italy:
ftp.flashnet.it, directory /pub/simtelnet/gnu/djgpp
Italy:
mcftp.mclink.it, directory /pub/simtelnet/gnu/djgpp
Saitama, Japan:
ftp.saitama-u.ac.jp, directory /pub/simtelnet/gnu/djgpp
Saitama, Japan:
ftp.riken.go.jp, directory /pub/simtelnet/gnu/djgpp
Japan:
ftp.iij.ad.jp, directory /pub/simtelnet/gnu/djgpp
Japan:
ftp.u-aizu.ac.jp, directory /pub/PC/simtelnet/gnu/djgpp
Japan:
ring.aist.go.jp, directory /pub/simtelnet/gnu/djgpp
Japan:
ring.asahi-net.or.jp, directory /pub/simtelnet/gnu/djgpp
Latvia:
ftp.lanet.lv, directory /pub/mirror/simtelnet/gnu/djgpp
Malaysia:
ftp.jaring.my, directory /pub/simtelnet/gnu/djgpp
Malaysia:
ftp.mimos.my, directory /pub/simtelnet/gnu/djgpp
Mexico:
ftp.gdl.iteso.mx, directory /pub/simtelnet/gnu/djgpp
Netherlands:
ftp.euro.net, directory /d5/simtelnet/gnu/djgpp/
Utrecht, Netherlands:
ftp.nic.surfnet.nl, directory
/mirror-archive/software/simtelnet/gnu/djgpp
Wellington, New Zealand:
ftp.vuw.ac.nz, directory /pub/simtelnet/gnu/djgpp
Bergen, Norway:
ftp.bitcon.no, directory /pub/simtelnet/gnu/djgpp
Krakow, Poland:
ftp.cyf-kr.edu.pl, directory /pub/mirror/Simtel.Net/gnu/djgpp
Poznan, Poland:
ftp.man.poznan.pl, directory /pub/simtelnet/gnu/djgpp
Warsaw, Poland:
ftp.icm.edu.pl, directory /pub/simtelnet/gnu/djgpp
Aveiro, Portugal:
ftp.ua.pt, directory /pub/simtelnet/gnu/djgpp
Portugal:
ftp.ip.pt, directory /pub/simtelnet/gnu/djgpp
Romania:
ftp.sorostm.ro, directory /pub/simtelnet/gnu/djgpp
Slovakia:
ftp.uakom.sk, directory /pub/simtelnet/gnu/djgpp
Slovenia:
ftp.arnes.si, directory /software/simtelnet/gnu/djgpp
Johannesburg, South Africa:
ftp.is.co.za, directory /pub/simtelnet/gnu/djgpp
Stellenbosch, South Africa:
ftp.sun.ac.za, directory /pub/simtelnet/gnu/djgpp
Seoul, South Korea:
ftp.nuri.net, directory /pub/simtelnet/gnu/djgpp
South Korea:
ftp.sogang.ac.kr, directory /pub/simtelnet/gnu/djgpp
South Korea:
sunsite.snu.ac.kr, directory /pub/simtelnet/gnu/djgpp
Spain:
ftp.rediris.es, directory /mirror/simtelnet/gnu/djgpp
Stockholm, Sweden:
ftp.sunet.se, directory /pub/simtelnet/gnu/djgpp
Zurich, Switzerland:
ftp.switch.ch, directory /mirror/simtelnet/gnu/djgpp
Chung-Li, Taiwan:
ftp.ncu.edu.tw, directory /Packages/simtelnet/gnu/djgpp
Taipei, Taiwan:
nctuccca.edu.tw, directory /PC/simtelnet/gnu/djgpp
Nonthaburi, Thailand:
ftp.nectec.or.th, directory /pub/mirrors/simtelnet/gnu/djgpp
Edinburgh, UK:
emwac.ed.ac.uk, directory /mirror/simtelnet/gnu/djgpp
Lancaster, UK:
micros.hensa.ac.uk, directory /pub/simtelnet/gnu/djgpp
London, UK:
sunsite.doc.ic.ac.uk, directory /packages/simtelnet/gnu/djgpp
London, UK:
ftp.demon.co.uk, directory /pub/simtelnet/gnu/djgpp
Concord, California, USA:
ftp.cdrom.com, directory /pub/simtelnet/gnu/djgpp
California, USA:
ftp.digital.com, directory /pub/simtelnet/gnu/djgpp/
Urbana, Illinois, USA:
uarchive.cso.uiuc.edu, directory /pub/systems/pc/simtelnet/gnu/djgpp
Massachusets, USA
ftp.bu.edu, directory /pub/mirrors/simtelnet/gnu/djgpp/
Rochester, Michigan, USA:
OAK.Oakland.Edu, directory /pub/simtelnet/gnu/djgpp
New York, NY, USA:
ftp.rge.com, directory /pub/systems/simtelnet/gnu/djgpp/
Oklahoma, USA:
ftp.ou.edu, directory /pub/simtelnet/gnu/djgpp/
Corvallis, Oregon, USA:
ftp.orst.edu, directory /pub/simtelnet/gnu/djgpp
Utah, USA:
ftp.cyber-naut.com, directory /pub/simtelnet/gnu/djgpp
Virginia, USA:
mirrors.aol.com, directory /pub/simtelnet/gnu/djgpp/
File: djgppfaq.info, Node: CCT, Next: How to download, Prev: Where to find, Up: Getting DJGPP
4.2 CCT sites
=============
**Q*: Where can I find the nearest CCT site?*
*A* : Look up the site nearest to you in the list below:
Note that the copyright to the name "SimTel" is owned by Walnut Creek which
sponsors the SimTel repository, so the CCT mirrors are in the process of
renaming their directories to `Coast.' Therefore, if you don't find the
directories listed below, replace "SimTel" by "Coast" and try again.
The primary CCT site is in Detroit, Michigan, USA:
ftp.coast.net, directory /Coast/vendors/djgpp/.
Here is a list of hosts by countries that offer mirror sites:
Canberra, Australia:
archie.au, directory /micros/pc/SimTel/vendors/djgpp
Edmonton, AB, Canada:
ftp.agt.net, directory /pub/SimTel/vendors/djgpp
Prague, Czech Republic:
pub.vse.cz, directory /pub/simtel/vendors/djgpp
London, England:
src.doc.ic.ac.uk, directory /pub/packages/simtel/vendors/djgpp
Liverpool, England:
ftp.mersinet.co.uk, directory /pub/ibmpc/coast/vendors/djgpp
London, England:
ftp.demon.co.uk, directory /pub/mirrors/simtel/vendors/djgpp
Chemnitz, Germany:
ftp.tu-chemnitz.de, directory /pub/simtel/vendors/djgpp
Mainz, Germany:
ftp.uni-mainz.de, directory /pub/pc/mirrors/simtel/vendors/djgpp
Tuebingen, Germany:
ftp.uni-tuebingen.de, directory /pub/simtel/vendors/djgpp
Hong Kong:
ftp.cs.cuhk.hk, directory /pub/simtel/vendors/djgpp
Hong Kong:
sunsite.ust.hk, directory /pub/simtel/vendors/djgpp
Dublin, Ireland:
ftp.hea.ie, directory /pub/simtel/vendors/djgpp
Haifa, Israel:
ftp.technion.ac.il, directory /pub/unsupported/simtel/vendors/djgpp
Naples, Italy:
ftp.unina.it, directory /pub/simtel/vendors/djgpp
Pisa, Italy:
cnuce-arch.cnr.it, directory /pub/msdos/simtel/vendors/djgpp
Rome, Italy:
ftp.flashnet.it, directory /mirror/simtel/vendors/djgpp
Rome, Italy:
cis.utovrm.it, directory /SimTel/vendors/djgpp
Tokyo, Japan:
ftp.crl.go.jp, directory /pub/pc/archives/simtel/vendors/djgpp
Tokyo, Japan:
ftp.web.ad.jp, directory /pub/mirrors/Coast/vendors/djgpp
Tokyo, Japan:
ring.aist.go.jp, directory /pub/coast/vendors/djgpp
Tokyo, Japan:
ring.asahi-net.or.jp, directory /pub/coast/vendors/djgpp
Seoul, Korea:
ftp.kornet.nm.kr, directory /pub/SimTel/vendors/djgpp
Seoul, Korea:
ftp.nowcom.co.kr, directory /pub/SimTel/vendors/djgpp
Utrecht, Netherlands:
ftp.nic.surfnet.nl, directory
/mirror-archive/software/simtel-vendors/djgpp
Poznan, Poland:
ftp.man.poznan.pl, directory /mirror/simtel/vendors/djgpp
Warsaw, Poland:
ftp.icm.edu.pl, directory /pub/simtel/vendors/djgpp
Moscow, Russia:
ftp.radio-msu.net, directory /mirror/Coast/vendors/djgpp
Singapore:
ftp.singnet.com.sg, directory /pub/mirrors/SimTel/vendors/djgpp
Slovak Republic:
ftp.uakom.sk, directory /pub/SimTel/vendors/djgpp
Taipei, Taiwan:
nctuccca.edu.tw, directory /PC/simtel/vendors/djgpp
Bangkok, Thailand:
ftp.bu.ac.th, directory /pub/SimTel/vendors/djgpp
Sunnyvale, CA, USA:
ftp.drcdrom.com, directory /Coast/vendors/djgpp
Note that DJGPP was moved to the `SimTel/vendors/' directory on most CCT
mirrors about a year ago. This is because CCT claims a compilation copyright
on its collection, to prevent people from copying the CD-ROMs which are
distributed by CCT. The GNU GPL prohibits *any* restrictions, even on
compilations. So, FSF asked for GNU and GNU-related files to be moved to a
separate directory to keep people from accidentally thinking that their
rights were being reduced.
File: djgppfaq.info, Node: How to download, Next: DJGPP by WWW, Prev: CCT, Up: Getting DJGPP
4.3 How do I download DJGPP?
============================
**Q*: How do I download files from these sites?*
*A* : FTP to the nearest site, log in as `anonymous', give your full e-mail
address as password, and chdir to the `djgpp' subdirectory (the exact path to
it might be different on different mirrors, check out *Note the DJGPP archive
path: Where to find, for your nearest mirror.) Then issue the `binary'
command and download files you need (*note the list of required files: What
to download.) with the `get' command.
File: djgppfaq.info, Node: DJGPP by WWW, Next: What to download, Prev: How to download, Up: Getting DJGPP
4.4 What if I don't know what `FTP' is?
=======================================
**Q*: What is that `FTP' thing? I only use `Mosaic' for Internet access.*
*A* : OK, here are some URLs for your Web browser:
- The main SimTel site, at this URL:
http://www.simtel.net/simtel.net/gnu/djgpp/
- The main CCT site, at this URL:
http://www.coast.net/Coast/vendors/djgpp/
- The CCT mirror in Rochester, MI, at this URL:
http://www.acs.oakland.edu/oak/SimTel/vendors/djgpp/
- The CCT mirror in St. Louis, MO, at this URL:
http://wuarchive.wustl.edu/systems/msdos/simtel/vendors/djgpp/
You can also convert any of the mirrors' addresses listed in *Note the list
of SimTel mirrors: Where to find, above to a valid URL by prepending `ftp://'
to it. For example, here is the URL for FTP from the primary CCT FTP site,
e.g. ftp://ftp.coast.net/Coast/vendors/djgpp/.
Gopher users can access CCT files through a Gopher client,
gopher://gopher.oakland.edu.
For those of you who only have an e-mail connection to the Internet, CCT
files may be also obtained by e-mail from various ftp-mail servers or through
the BITNET/EARN file servers. For details send a message to the CCT list
server <listserv@SimTel.Coast.NET> with this command in the message body:
get simtel-mailserver.info
File: djgppfaq.info, Node: What to download, Next: Disk space, Prev: DJGPP by WWW, Up: Getting DJGPP
4.5 What Files to Download?
===========================
**Q*: What's the minimum set of `.zip' files I need to download?*
*A* : This depends on what you are planning to use DJGPP for.
* To only run DJGPP-compiled programs, you MUST download all of these: (1)
(*note What to download-Footnotes::)
`v2/readme.1st'
This explains how to install DJGPP and get started with using it.
`v2/faq202b.zip'
The latest edition of this FAQ list. Use it whenever you have
problems installing and using DJGPP.
`v2misc/csdpmi3b.zip'
CWSDPMI, the DJGPP free DPMI server. (If you can get DPMI services
in your environment, like if you run under Windows, QDPMI, or OS/2,
you don't need CWSDPMI, but I recommend downloading it nonetheless
so you can try it in case you have trouble with other DPMI servers.)
`v2misc/pmode11b.zip'
This is an alternative DPMI server, PMODE/DJ. Its memory footprint
is smaller than CWSDPMI and it can be bundled with DJGPP programs
to make a stand-alone executable that doesn't require a DPMI server
to run. PMODE/DJ doesn't support virtual memory and its
implementation of the DPMI spec is a bit more restricted than that
of CWSDPMI.
* For developing C programs (no C++), you MUST download all of the above,
plus the following:
`v2gnu/bnu252b.zip'
The GNU Binutils, including `as', the GNU assembler; `ld', the GNU
linker; and their docs.
`v2/djdev200.zip'
C header files, minimal development environment, DJGPP-specific
utilities and documentation.
`v2/djtst200.zip'
A set of example programs to test your installation.
`v2gnu/gcc272b.zip'
The GNU C Compiler binaries and docs (including the docs for the C++
compiler).
`v2gnu/txi360b.zip'
Info, a stand-alone program to read GNU hypertext documentation
files, and an environment to produce such files. Without `info',
you cannot read the docs included with the GNU software tools.
* For developing C++ programs, you will need all of the above, plus the
following:
`v2gnu/gpp272b.zip'
The GNU C++ compiler binary (the docs are part of the gccNNNb.zip
package, see above).
`v2gnu/lgp271b.zip'
The C++ header files and the GNU classes libraries, and their docs.
`v2gnu/obc272b.zip'
If you want to develop Objective-C programs, you will need this
file, which includes the Objective-C compiler and header files.
* The following are some optional packages which you might want:
- Debugging:
`v2gnu/gdb412b.zip'
GDB, the GNU Debugger and its docs. (Note that the `djdev'
distribution includes two simpler debuggers, `edebug' and
`fsdb.' The latter presents a user interface similar to that
of Turbo Debugger.)
- Additional development tools (consider getting at least the Make
distribution):
`v2apps/rhideb.zip'
The RHIDE integrated development environment for DJGPP,
written by Robert Hoehne
<Robert.Hoehne@Mathematik.TU-Chemnitz.DE>.
`v2/djlsr200.zip'
The sources of the DJGPP C library and utilities written
specifically for DJGPP. If you can afford the disk space (it
requires about 10MB), I recommend installing it, so you can
easily fix possible library bugs.
`v2gnu/flx252b.zip'
Flex, a Lex-like lexical analyzer generator, and its docs.
`v2gnu/bsn124b.zip'
Bison, a Yacc-like parser generator, and its docs.
`v2gnu/dif271b.zip'
GNU Diffutils (diff, cmp, diff3, sdiff), and their docs.
`v2gnu/mak373b.zip'
GNU Make program with its docs.
`v2gnu/pat21b.zip'
GNU Patch program and docs.
`v2gnu/sed118b.zip'
GNU Sed program and its docs.
- Developing text-mode and graphics GUI applications:
`v2tk/grx20.zip'
The DJGPP graphics library.
`v2tk/bcc2grx.zip'
The interface library to convert Borland graphics calls to GRX
library calls.
`v2tk/pdc22.zip'
Public-domain Curses library.
For description of additional files not mentioned here, get the file
`00_index.txt'; it contains a full list of the distribution files and a
short description of every file.
File: djgppfaq.info, Node: What to download-Footnotes, Up: What to download
(1) The version numbers of the packages below might not be up to date. For
the latest versions, check out the DJGPP Mini-FAQ posted weekly to the
comp.os.msdos.djgpp news group.
File: djgppfaq.info, Node: Disk space, Next: DJGPP = Fatware, Prev: What to download, Up: Getting DJGPP
4.6 How much disk space will I need?
====================================
**Q*: Wow, that's a lot of files. How much disk storage will I need?*
*A* : The following lists the approximate disk space required for several
major configurations, and additional storage required for some optional
packages:
Execution-only environment..................300 KBytes
Developing C programs.......................13 MBytes
Developing C++ programs.....................17 MBytes
Developing Objective-C programs.............15 MBytes
Additional storage for DJGPP sources........10 MBytes
Additional storage for GDB..................1.1 MBytes
Additional storage for Flex.................280 KBytes
Additional storage for Bison................310 KBytes
Additional storage for Diffutils............560 KBytes
Additional storage for Make.................520 KBytes
Additional storage for Patch................120 KBytes
Additional storage for Sed..................73 KBytes
Additional storage for Graphics libraries...4 MBytes
Note that the above lists only approximate numbers. In particular, the disk
cluster size can significantly change the actual disk space required by some
of the distributions (those with a large number of files). The numbers above
are for disks up to 512MB which have 8KB-long clusters.
In addition to the space for installing the software, you will need some free
disk space for the swap file. You should leave enough free disk space to
make the total virtual memory at least 20 MBytes; that will be enough for
most applications. Invoke the `go32-v2.exe' program without arguments to see
how much DPMI memory and swap space DJGPP applications can use. Depending on
your DPMI host, you might need to review its virtual memory settings in
addition to leaving free disk space; `CWSDPMI' requires only that enough free
disk space be available, but other DPMI hosts have special settings to
specify how much virtual memory they let their clients use, as *Note
explained below: How much memory.
File: djgppfaq.info, Node: DJGPP = Fatware, Prev: Disk space, Up: Getting DJGPP
4.7 Can I get away with less megabytes?
=======================================
**Q*: The above table means that I need more than 17 MBytes for C/C++
development environment; that's about 7 1.44MB diskettes to hold even the
compressed archive!! Seems to me DJGPP is afflicted by the *fatware*
disease...*
**Q*: Pulling that many megabytes through the net from my overloaded SimTel
mirror is almost impossible. Can't you prepare a ZIP archive which only
includes stuff I can't do without?*
*A* : There are a number of shareware/freeware programs floating around which
allow formatting DOS diskettes to almost twice their usual capacity, so you
can use less floppies. One such program is 2M, available from CCT mirrors as
2mNN.zip, e.g. ftp://ftp.coast.net/Coast/msdos/diskutil/2m30.zip.
To make downloading DJGPP easier, download and compile the `BatchFTP'
program. It allows you to submit a script of FTP commands and will
repeatedly try to login into the FTP site you specify until the script is
successfully completed. It is smart enough to understand the messages which
the FTP server sends to you (like `login refused' etc.) and also is nice to
the remote server by sleeping for some time between login attempts.
`BatchFTP' is free software and can be found on many FTP sites, e.g.
ftp://oak.oakland.edu/pub/unix-c/networks/batchftp.tar.Z.
`BatchFTP' is a Unix program; those who access the net from their PC (not by
dialing into some Unix host with a shell account), can use a nice
FTP-automating utility called `AutoWinNet' (get the file autownNN.zip from
your nearest CCT mirror, e.g.
ftp://ftp.coast.net/Coast/win3/winsock/autown19.zip).
As for the minimal DJGPP installation, volunteers are welcome to prepare such
an archive and make it publicly available, in the same spirit as `EZ-GCC' did
for DJGPP v1.x.
File: djgppfaq.info, Node: Docs, Next: Trouble, Prev: Getting DJGPP, Up: Top
5. The DJGPP Documentation
**************************
This chapter explains where to find and how to read DJGPP documentation, and
how to solve occasional problems with the docs system.
* Menu:
* Where is the docs:: Where to find the docs and how to read them.
* No Info:: For those who can't stand Info.
* Printed docs:: How to produce a printed manual.
* Ready PS:: Where to find printer-ready manuals.
* Can't find docs:: For some programs it's tricky ...
* Man pages:: How to read these.
* Last resort:: Look in the source, of course!
File: djgppfaq.info, Node: Where is the docs, Next: No Info, Prev: Docs, Up: Docs
5.1 Where are the documentation files?
======================================
**Q*: I don't see any documentation files...*
*A* : The documentation files are in the `info/' subdirectory of your main
DJGPP installation directory. You will need a program to read these docs,
which are hypertext structured files. You have several choices:
a. Use the stand-alone `Info' reader.
Get the file txi360b.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/txi360b.zip, which
includes `INFO.EXE' and its docs. Unzip it and run `Info.' It will
bring up a (hopefully) self-explanatory online help system. Confused?
Press `?' to see the list of all Info commands. Still confused? Press
`h' to have `Info' take you on a guided tour through its commands and
features.
b. Use the `Info' command of your favorite Emacs-like editor.
If you use Emacs, you already know about `Info.' (What's that? You
don't? Type `C-h <i>' and you will get the top-level menu of all the
Info topics.)
File: djgppfaq.info, Node: No Info, Next: Printed docs, Prev: Where is the docs, Up: Docs
5.2 How to read the docs without `Info?'
========================================
**Q*: I'm too old/lazy/busy to learn yet another browser, and I despise
uGNUsable programs like Emacs. How in the world can I read the DJGPP docs??*
*A* : Info files are almost plain ASCII files, so you should be able to
browse them with your favorite text file browser or editor. You will lose
the hypertext structure and you might have a hard time finding the next
chapter (hint: look up the name of the Next node at the beginning of this
node, then use the search commands of the browser, or the Grep program, to
find that name), but other than that you will see all the text.
Anthony Appleyard <A.APPLEYARD@fs2.mt.umist.ac.uk> has translated the Info
files for GNU C/C++ Compiler (`gcc.iNN') and GNU C Preprocessor (`cpp.iNN')
into ISO-8859 (aka plain ASCII), and Stephen Turnbull
<turnbull@shako.sk.tsukuba.ac.jp> has made them available on his anonymous
ftp and WWW server. You can get them as `gcc.txt' and `preprocessor.txt' by
anonymous ftp, e.g. ftp://turnbull.sk.tsukuba.ac.jp/pub/djgpp/doc/; or get
them with your Web browser, at this URL:
http://turnbull.sk.tsukuba.ac.jp/pub/djgpp/doc/
You can also produce pure ASCII files yourself, if you have their Texinfo
sources. These are usually called `*.txi' or `*.tex' and should be included
with the source distribution of every package. To produce an ASCII file
`foo.txt' from the Texinfo file `foo.txi', invoke the `Makeinfo' program like
this:
makeinfo --no-split --no-headers --output foo.txt foo.txi
The `Makeinfo' program is part of the Texinfo distribution which is available
in txi360b.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/txi360b.zip.
File: djgppfaq.info, Node: Printed docs, Next: Ready PS, Prev: No Info, Up: Docs
5.3 How to print the docs?
==========================
**Q*: I like my docs the old way: printed on paper, stacked near my
workplace. How can I print the documentation files which come with DJGPP?*
*A* : You will need to get and install a program called TeX or its
work-alike, like LaTeX or emTeX. (They are NOT part of DJGPP.) Then run your
TeX work-alike on the docs' *source* files (called `*.txi' or `*.tex') which
you get with the source distribution of every package you download. You will
get a `.dvi' file which you can print; or you can run a DVI-to-PostScript
converter such as `DVIPS' to produce a PostScript output. `DVIPS' is a free
program; you can find it on SimTel mirrors, e.g.
ftp://ftp.simtel.net/pub/simtelnet/msdos/postscrp/dvips558.zip.
DJGPP comes with a program called `TEXI2PS' which can convert *.txi files to
a crude PostScript; try it if you don't care much about the appearance of the
printed docs.
If TeX won't run, check that you have the file `texinfo.tex' which defines
the TeX macros specific to Texinfo files. If you don't, get the GNU or DJGPP
Texinfo distribution which includes that file.
If you'd like to produce printed docs of the library reference, TeX will
complain that it cannot find a file named `libc2.tex'. This file is
generated from all the `*.txh' files in the DJGPP source distribution
(`djlsr200.zip'). In order to build this file, you need to go to `src/libc'
and type this from the DOS command prompt:
make doc
Note that some docs files (notably, those for GCC) will produce voluminous
print-outs. You *have* been warned!
File: djgppfaq.info, Node: Ready PS, Next: Can't find docs, Prev: Printed docs, Up: Docs
5.4 Where can I find docs in PostScript?
========================================
**Q*: I don't have all these fancy packages, and I don't have disk space to
install them in the first place. Can't you guys just include with DJGPP a
set of ready-to-print PostScript files?*
*A* : They are *very* large and would eat up too much storage (much more
than the fancy packages you don't want to install). Most of the people read
the docs on-line and never print them anyway. Sorry.
However, some *Good Samaritans* from all across the Net have taken time and
effort to produce the docs in PostScript format and made them available by
anonymous ftp. The most full set of docs for the latest versions of GNU
software is available in plain ASCII, `zip' and `tar.gz' format by anonymous
ftp from phi.sinica.edu.tw, e.g. ftp://phi.sinica.edu.tw/pub/aspac/gnu/; they
are all for A4 paper. Other places to look for PostScript versions of GNU
documentation are:
In European A4 format, e.g. ftp://liasun.epfl.ch/pub/gnu/ps-doc/.
In US letter format, e.g. ftp://primus.com/pub/gnu-ps/.
Many GNU manuals in `HTML' (hypertext) format, suitable for reading with your
Web browser, can be viewed at the DJGPP Web site, at this URL:
http://www.delorie.com/gnu/docs/
DJGPP includes a utility called `TEXI2PS' which converts the Texinfo source
files to crude PostScript; try it.
File: djgppfaq.info, Node: Can't find docs, Next: Man pages, Prev: Ready PS, Up: Docs
5.5 Some docs are nowhere to be found...
========================================
**Q*: I looked in my `info/' subdirectory, but I can't find docs for some of
the utilities, like `Sed' or `Gprof.'*
*A* : Download the source archive (`*s.zip') for that package and look
inside it, usually in the directory called `man' or `doc.'
File: djgppfaq.info, Node: Man pages, Next: Last resort, Prev: Can't find docs, Up: Docs
5.6 What are these `foo.1' files?
=================================
**Q*: Some docs files are called `foo.1' or `bar.man' or `baz.nroff', and
they seem to be written in some weird format which is very difficult to read.
How can I convert them to readable text files?*
*A* : That weird format is the `troff' format which is used for writing Unix
manual pages. The Unix command `man' converts them to formatted text files
which are usually displayed with a program like `more' or `less' (and here
`less' is considered to be more than `more' :-)). The formatted file
includes bold and underlined letters produced by over-typing using Backspace
characters. To format these files, you can choose one of these methods:
* Get and install a DOS port of the `groff' package, or port it yourself
(a very difficult task). The latest `groff' distribution can be found
on the GNU ftp archive, e.g. ftp://ftp.gnu.ai.mit.edu/pub/gnu/ or any of
its mirrors. A port of (an old version of) Groff to (an old version of)
DJGPP can be downloaded from the DJGPP ftp server, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/groff.zip.
* Get and install `CAWF', a DOS program which knows about most of the
`troff' formatting commands. `CAWF' can be found on one of the CCT
mirrors, e.g. ftp://ftp.coast.net/Coast/msdos/textutil/cawf404.zip.
* Write or port a `man' clone. Source for one such clone was posted to
the DJGPP news group, so you can get it there, at this URL:
http://www.delorie.com/djgpp/mail-archives/djgpp/1995/06/19/12:57:43
You can also download this port from the DJGPP ftp server, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/man-pc.zip.
* Format the file on any Unix machine, and download the results to your PC.
Under Unix, typing `catman -p' will print the commands which are
required to do this; you can then run those commands on your `*.1'
`troff' source files.
No matter which of the above methods you choose, you will need some kind of
browser which understands how to show bold and underlined letters instead of
backspace-over-typed characters. I suggest to download a DOS port of GNU
Less, e.g. ftp://ftp.coast.net/Coast/msdos/textutil/less291x.zip, which uses
colors to show bold and underlined letters. A DJGPP port of `Less' should be
available from the usual DJGPP distribution sites. Another possibility is to
get the latest official GNU Less distribution, e.g.
ftp://ftp.gnu.ai.mit.edu/pub/gnu/less-316.tar.gz which can be compiled out of
the box with the Microsoft C and Borland C compilers. (Future versions of
`Less' will also compile with DJGPP.)
Another possibility for reading formatted man pages would be with an Emacs
editor, if you use one. Emacs has a special command to read man pages.
Beginning with version 3.6, the stand-alone `Info' program can also read man
pages (it invokes a subsidiary program `man' to format them, then displays
its output; see the file `readme.dj' in the DJGPP Texinfo distribution for
more details on how to set this up). So if you have the DJGPP Texinfo
distribution, you can read man pages with `Info' already; if not, just
download Texinfo, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/txi360b.zip.
Note that, for GNU packages, the man pages aren't always updated on a regular
basis. If you need more up-to-date information, see the Info files.
File: djgppfaq.info, Node: Last resort, Prev: Man pages, Up: Docs
5.7 What if the docs don't say enough?
======================================
**Q*: OK, I've got the docs and have read them, but I still can't figure out
some details.*
*A* : Download the sources and look there, or ask on the net--either the
DJGPP News group or an appropriate GNU News group.
File: djgppfaq.info, Node: Trouble, Next: Compiler performance, Prev: Docs, Up: Top
6. When the Compiler (or `Make', or `Info', or ...) Crashes...
**************************************************************
This chapter explains how to deal with certain problems which may prevent
DJGPP programs from running on your machine. The first 8 items on the next
menu describe specific problems; if yours doesn't go away with these
techniques, read the description of *Note the general debugging procedure:
General trouble.
* Menu:
* No DPMI:: You must have or install a DPMI server.
* Buggy DPMI:: It might crash all of your v2.x programs.
* GCC optimizations:: GCC sometimes crashes when optimizing.
* Fatal signal:: GCC says *"Fatal signal X"*.
* Unknown filetype:: GCC says *"Unknown filetype"*.
* QEMM AUTO:: Can't use this with DJGPP.
* Make hangs:: Compiler hangs, but only under Make.
* Info can't find "Top":: Info won't display some files.
* General trouble:: Look here for any problem not covered above.
* Redirect:: How to redirect GCC messages to a file.
* Deja vu:: Look up your problem in the
*comp.os.msdos.djgpp* archives.
* Totally lost:: When nothing seems to help, ask on the net.
File: djgppfaq.info, Node: No DPMI, Next: Buggy DPMI, Prev: Trouble, Up: Trouble
6.1 GCC says "No DPMI"
======================
**Q*: I'm trying to run `gcc', but all I get is a message saying "Load error:
no DPMI". What am I doing wrong?*
*A* : You don't have a DPMI server installed, and DJGPP v2 requires it to
run. You can either use one of the commercial DPMI servers (e.g., run `gcc'
in a DOS box under Windows) or download and install CWSDPMI
(`csdpmi3b.zip') which is a free DPMI server written for DJGPP.
File: djgppfaq.info, Node: Buggy DPMI, Next: GCC optimizations, Prev: No DPMI, Up: Trouble
6.2 Buggy DPMI host or junk in DJGPP.ENV can crash v2.x programs
================================================================
**Q*: When I try to run Info, it crashes immediately...*
**Q*: I cannot run v2.0 applications: they all hang or reboot my system,
while v1.x apps run OK. Is this what v2.0 is all about--getting me out of
the DJGPP community?*
*A* : No, believe it or not, we don't want to oust you. Your problems might
be caused by a buggy "DPMI" (*note DOS Protected Mode Interface: DPMI Spec.)
host installed on your machine. One DPMI host which is particularly known to
be a source of trouble is the DPMI server which comes with Novell NWDOS.
Please see if v2.0 programs run when you disable DPMI services of your usual
configuration (DJGPP will then use the CWSDPMI program supplied with DJGPP).
Another DPMI host which is known to cause problems in DJGPP is Quarterdeck's
QDPMI which comes with QEMM 7.5. It was reported to cause `Info' and all
DJGPP debuggers to crash. If you use QDPMI, upgrade to the version 7.53 or
later (patches for that version are available from the Quarterdeck's ftp
site), or disable QDPMI and use CWSDPMI.
Another cause of crashes in `Info' might be trailing whitespace in the
`DJGPP.ENV' file. The telltale signs of this failure are a stack dump that
is bogus, or doesn't start with your `main' function, or a series of SIGSEGV
that won't stop. Actually, this is a bug in the DJGPP v2.0 startup code, so
any DJGPP program can crash in this way, but since the last section of stock
`DJGPP.ENV' belongs to `Info', it is the one which suffers most from this
bug. Make sure your `DJGPP.ENV' doesn't have a `^Z' character at the end
(some DOS editors put it if you edit the file), and doesn't end with a blank
line. Alternatively, upgrade to DJGPP v2.01 or later, where that bug is
fixed.
File: djgppfaq.info, Node: GCC optimizations, Next: Fatal signal, Prev: Buggy DPMI, Up: Trouble
6.3 GCC can crash during optimization
=====================================
**Q*: When I compile my program, the compiler crashes, but the problem seems
to go away if I compile without optimization.*
*A* : For some programs, this can be caused by an insufficient stack. Some
source files make `cc1.exe' or `cc1plus.exe' need preposterously large
amounts of stack space, but only when you turn on optimizations. (One user
reported that an innocent-looking C source file required 700KB of stack
before `cc1.exe' was able to compile it with optimizations!) Try stubediting
the compiler to enlarge its stack, as described elsewhere in this FAQ, *Note
how to enlarge the stack: Fatal signal, before you try any other remedies in
this section.
GCC 2.6.0 was known to crash when optimizing, especially when compiling C++
programs, but it can also happen for later versions, especially if your code
has some syntactic or semantic bug. (This is usually a genuine GCC bug, not
something special to DJGPP.) Upgrade to the latest version of GCC. If that
doesn't help, then narrow the offending code fragment using the `#if 0 ...
#endif' paradigm. If this fragment includes an error, correct it and try
again; if it is syntactically and semantically correct, then rewrite it as
equivalent, but syntactically different one.
An undocumented GCC switch can sometimes help you zero in on the code
fragment that causes GCC to crash. If you add `-Q' to the GCC command line,
it will print the name of every function it compiles. The function that
makes it crash is probably the one whose name is the last one printed, or the
one after that.
You can also try to disable the strength-reduction optimizations of GCC by
using the `-fno-strength-reduce' switch. GCC has a known bug in that type of
optimization which goes back as far as version 2.5.8 and is only corrected in
GCC 2.7.2.1 or later; this bug raises its ugly head on rare occasions, but is
notoriously hard to hunt down when it does. (The stock v2.0 distribution
should by default disable this kind of optimizations on the `lib/specs' file.)
As an extreme measure, don't optimize at all, if that's the only way to make
your program work.
Another reason for this could be some problem with your system hardware or
the BIOS (like if you set an incorrect number of wait states when accessing
memory). To check, try running the same compilation on another machine, or
review your BIOS settings.
Yet another cause for such crashes can be connected with excess memory and/or
stack usage that GCC needs when compiling certain programs. For details
about this, see *Note CWSDPMI allocation problems: Fatal signal, in the next
section.
File: djgppfaq.info, Node: Fatal signal, Next: Unknown filetype, Prev: GCC optimizations, Up: Trouble
6.4 What does "Fatal signal X" mean?
====================================
**Q*: I get "fatal signal 2" when I run GCC.*
**Q*: GCC aborts with "Internal compiler error" when compiling a large C++
program.*
*A* : When GCC reports a "signal", it really means that an error occurred
trying to run one of the compiler passes. The "signal" number is the DOS
error code, and 2 means "file not found" (dig out your DOS reference for
other error codes). This means GCC couldn't find some program it needs to
run to compile your source. Check the `COMPILER_PATH' environment variable
or what the `COMPILER_PATH' line in the `DJGPP.ENV' file says, and make sure
they point to the directory where DJGPP programs reside. Also check that the
named directory has all the required programs: `cpp.exe', `cc1.exe',
`cc1plus.exe', `cxxfilt.exe', `gasp.exe', `as.exe', `ld.exe', and (for
Objective-C) `cc1obj.exe.' You can use the `-v' switch to GCC to see what
programs it invokes and which one of them causes the fatal error.
The "Internal compiler error" message usually means a genuine bug in GCC
(which should be reported to FSF), but it can also happen when GCC requests
additional chunk of memory, and the DPMI server fails to allocate it because
it exhausts available memory for its internal tables. Release 1 of CWSDPMI
can fail like this if an application asks for a large number of small memory
chunks. If you use release 1 of CWSDPMI, you can enlarge the maximum space
that CWSDPMI uses if you get a CWSDPMI heap-fix patch, e.g.
ftp://ftp.neosoft.com/pub/users/s/sandmann/csdpmi1heapfix.zip. Beginning
with release 2, CWSDPMI defines a larger (6KB) default heap that is
configurable by CWSPARAM program to be anywhere between 3K and 40K bytes,
without recompiling CWSDPMI. You should upgrade to the latest CWSDPMI if you
experience such problems.
You can also run `stubedit' on `cc1plus.exe' and enlarge its maximum stack
size to 512K bytes (some people report that they needed to enlarge both the
heap of CWSDPMI and the stack of the C++ compiler to make this problem go
away). If you see such problems when compiling a C program, stubedit
`cc1.exe.'
For a program that you wrote, another work-around is to use an alternative
algorithm for `sbrk', by putting the following somewhere in your program:
#include <crt0.h>
int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;
Note that the unixy sbrk algorithm might cause trouble in programs that hook
hardware interrupts.
File: djgppfaq.info, Node: Unknown filetype, Next: QEMM AUTO, Prev: Fatal signal, Up: Trouble
6.5 What does "Unknown filetype" mean?
======================================
**Q*: I get error messages saying "Unknown filetype" from GCC.*
**Q*: Since a few days ago, whenever I try to run most of the DJGPP programs,
they print a message "C:\DJGPP\BIN\prog.exe: not COFF" and just terminate.
Help!!!*
*A* : It might be that your `STUBIFY.EXE' is infected by a virus. (This is
*not* a joke! It did happen to a few of us and can happen even to you.) As
the DOS stub prepended to the DJGPP programs is very small, most viruses
cannot attach themselves to it without overwriting the beginning of the DJGPP
COFF image, therefore triggering this error from the code in the stub that
loads the COFF image.
Another possible cause of the "Unknown filetype" message is that you mix a
v2.0 `gcc.exe' driver with `cc1plus.exe', `cc1.exe' or other programs from an
old v1.x distribution.
File: djgppfaq.info, Node: QEMM AUTO, Next: Make hangs, Prev: Unknown filetype, Up: Trouble
6.6 You can't use `QEMM' auto/off mode with DJGPP
=================================================
**Q*: Why do I get error message from `CWSDPMI' if I keep QEMM in auto/off
mode and run DJGPP?*
*A* : When QEMM is in auto/off mode and there isn't anything in the system
that is using any of QEMM's features, the CPU remains in real mode.
Normally, when CWSDPMI finds the CPU in real mode, it will try to use raw XMS
services to access the extended memory. Unfortunately, when some program
requests XMS services, it will cause QEMM to turn on. So if CWSDPMI tries to
switch into protected mode, QEMM will trap it and give a protection violation
warning. To avoid this unfortunate event (which requires a system reboot to
fix), CWSDPMI first checks to see if enabling XMS caused the CPU to switch
into v86 mode (meaning QEMM just turned on). If so, CWSDPMI gracefully exits
after telling you it can't work in this set-up, like this:
"Error: Using XMS switched the CPU into V86 mode."
All you have to do to work around this is force QEMM to be ON whenever you
run DJGPP programs so that CWSDPMI will know how to work with it properly.
To do this, just turn QEMM on before running any DJGPP program, with this
command:
c:\qemm\qemm on
(that assumes your QEMM directory is `c:\qemm').
File: djgppfaq.info, Node: Make hangs, Next: Info can't find "Top", Prev: QEMM AUTO, Up: Trouble
6.7 Compiler hangs, but only when invoked from Make
===================================================
**Q*: My compiles run OK from the command line, but hang when I invoke the
compiler from Make.*
*A* : Be sure you are invoking the correct Make program. Borland Make was
reported to cause trouble when you invoke GCC with it (because Borland's
programs are 16-bit DPMI clients, and the DPMI 0.9 spec doesn't allow mixing
them with 32-bit DPMI clients such as DJGPP programs). It might be that
another program called `make.exe' is found earlier on your `PATH' than the
Make which came with DJGPP.
If you use Make compiled under DJGPP v1.x, you will also experience all kinds
of trouble when invoking programs compiled under DJGPP v2.0. That's because
v1.x programs cannot spawn v2.0 programs directly (the v1.x program sees that
the child is a DJGPP program and tries to call `go32' to run it, but `go32'
cannot run v2 programs). The result usually will be that the child either
crashes or silently exits. If that's your problem, be sure to upgrade your
`Make' to the port distributed with v2. (Note that v2.x programs generally
know how to spawn both v1.x and v2.x programs.) You can use `go32-v2' to work
around this limitation (*note description of go32-v2: go32-v2., below), but I
suggest doing that only if you absolutely cannot upgrade to v2's `Make.'
Some users report that v1.x programs might sometimes hang or reboot the
machine when invoked from v2.0 Make, if the Makefile calls the v1.x program
by a name longer than the 8+3 DOS filename restriction (that is usual for
Makefiles that come from Unix). To work around, truncate the filename of
that program in the Makefile.
File: djgppfaq.info, Node: Info can't find "Top", Next: General trouble, Prev: Make hangs, Up: Trouble
6.8 Info doesn't like some files
================================
**Q*: When I run the Info browser, it tells me it cannot find the node "Top".*
*A* : Check your installation of info files. The file `DJGPP.ENV' in the
root of your DJGPP installation mentions the variable `INFOPATH' which should
point to the directory where Info looks for its files. It must find there a
file named `dir', the file you are trying to read, and other files with
`.iNN' or `.NN' extension, where `NN' is a number.
Assuming the above checks OK, and all the necessary info files are indeed
installed in those directories (did you remember to give that `-d' switch to
`PKUNZIP?'), it might be that some of the files were edited with a DOS-based
editor, which converted the <Newline> characters to the <CR>/<LF> pairs.
Some DOS ports of Info don't like this, because this invalidates the tag
tables included with the files which Info uses to quickly find the various
nodes.
To solve the problem, upgrade to the latest versions of Info ported to DJGPP,
which don't have this problem (beginning with version 3.6).
If you cannot upgrade for some reason, run `DTOU.EXE' on the offending files;
it will strip the extra <CR> characters to make Info happy. DTOU is in the
`bin/' subdirectory of your main DJGPP directory.
File: djgppfaq.info, Node: General trouble, Next: Redirect, Prev: Info can't find "Top", Up: Trouble
6.9 My problem isn't mentioned above!
=====================================
**Q*: I've installed DJGPP just like explained in the `README.*' files, but
when I run gcc, my machine crashes/hangs/needs cold boot.*
**Q*: When I compile my program, gcc says "Segmentation violation" and prints
all kinds of funny numbers and registers.*
**Q*: I get errors I can't figure out when I try to compile something.*
*A* : Add the `-v' switch to the GCC command line and run it again. It will
print all the subprograms (compiler passes) it is running. Then you can see
which subprogram caused the error, or where your machine crashes. This might
give you a hint on what's wrong.
Another cause of such problems might be that your system is set up
inefficiently. If GCC gets too few free RAM, it will run very slowly, and
you might think it crashed when in fact it isn't. (This kind of problem
usually happens on memory-starved machines.) Check out the *Note system
configuration advice: Config, in this FAQ list and configure your system
accordingly.
File: djgppfaq.info, Node: Redirect, Next: Deja vu, Prev: General trouble, Up: Trouble
6.10 I can't keep up with the error messages
============================================
**Q*: I want to read all the error messages that GCC throws at me, but there
are so many that I can't keep up. How can I redirect them to a file?*
**Q*: When I add `-v' to the GCC command line, how can I put all the
voluminous output into a file, so I don't miss anything when reporting a
problem?*
**Q*: I have this nifty graphics program which bombs from time to time, but
the registers and traceback info are hidden by the graphics display. How can
I see it?*
*A* : There are several alternatives:
a. You can use a shell smarter then `COMMAND.COM', such as `4DOS', which
knows how to redirect standard error stream to a file. 4DOS is
shareware and can be found on CCT mirrors, e.g.
ftp://ftp.coast.net/Coast/msdos/4dos/.
b. You can also run your program under any one of the programs which save
the output of programs they spawn in a file. I suggest using a program
called `SCRIPT', which is similar to its Unix namesake. It has an
advantage of saving everything which goes to screen *and* showing it on
the screen at the same time. You can find SCRIPT on CCT mirrors, e.g.
ftp://ftp.coast.net/Coast/msdos/screen/script11.zip.
c. Or you can use the `REDIR' program which comes with DJGPP. It also
redirects standard output and/or standard error to a file, but you don't
get a chance to look at the output while the program runs.
File: djgppfaq.info, Node: Deja vu, Next: Totally lost, Prev: Redirect, Up: Trouble
6.11 How to search DJGPP archives for similar problems
======================================================
**Q*: OK, I have all this voluminous output of `gcc -v', but I still have no
clue.*
*A* : Your problem might be one which has already been posted and solved on
the DJGPP News group. DJ Delorie <dj@delorie.com> has set up a searchable
News group archive on his Web server, at this URL:
http://www.delorie.com/djgpp/mail-archives/
You can search the *entire* mailing list archives in just a few seconds.
DJ's archives are always up to date, as they receive and store all posted
messages automatically, but the index is updated every 24 hours, so the last
day might not be searchable yet. To search the DJGPP archives at DJ's, point
your Web browser to the above URL and specify a list of keywords pertinent to
your problem. You will get a list of messages which include those keywords;
clicking on any of the messages will get the full text of that message.
Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp> has set up another search
engine which you can use to search the entire news group archive for an
arbitrary regular expression, at this URL:
http://turnbull.sk.tsukuba.ac.jp/cgi-bin/search
Point your Web browser to that URL and do whatever the instructions you get
tell you. You will receive a list of lines in the archive which contain your
regexp, with a two-line surrounding context. You can use this to decide
which parts of the archive you need to download and read.
Steve's archives can also be fast-searched, at this URL:
http://turnbull.sk.tsukuba.ac.jp/yaseppochi-gumi.html#djgpp
using any Web browser supporting `ISINDEX' capabilities. This is faster, but
supports only simple keyword searches, not regular expressions.
You can also download `gzip''ed copies of DJGPP correspondence split up by
months (the most recent month might not be up-to-date) from the anonymous ftp
server set up by Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp>. They
are available at turnbull.sk.tsukuba.ac.jp, e.g.
ftp://turnbull.sk.tsukuba.ac.jp/pub/djgpp/list-archive/. If you look for the
traffic from a specific time period, you should look for files named
`djgpp.YYMM.gz' (they are around 250K bytes each), where YY is the year and
MM is the month number. E.g., for February 1996 traffic get the file
`djgpp.9602.gz.' Alternatively, look for the file which holds list traffic
for the year and the month you need with your Web browser, at this URL:
http://turnbull.sk.tsukuba.ac.jp/pub/djgpp/list-archive/
Once you have the news group archives, or a relevant portion(s) thereof,
search for your problem by using some keywords specific to your problem, like
"crash", "violation", etc. The archive is just a text file, so any text file
viewer/editor with search capability can do it.
Note that Steve's archives have fallen behind lately to some degree, due to
him being busy with other matters; therefore, you could find that the
archives aren't entirely up to date. Steve says that he will return to
regular maintenance of the archives later this year.
File: djgppfaq.info, Node: Totally lost, Prev: Deja vu, Up: Trouble
6.12 How to ask DJGPP gurus for help
====================================
**Q*: I've searched the news group archives, but didn't find anything
helpful. I am totally lost. *Help!!!**
**Q*: I don't have time to download all these huge files, not to mention
looking through them. Can't you DJGPP gurus help me? *Please??**
*A* : DJGPP is famous for its outstandingly fast and effective user support.
To get a fast and effective solution to your problem, you will have to
supply the relevant info about your system, and describe exactly how things
went wrong for you. To gather this info, do the following:
* At the DOS command prompt, type `set > environ.lst', then press <Enter>.
* Invoke the `go32-v2' program (it's in your `bin/' subdirectory) and save
its output.
* Post to the comp.os.msdos.djgpp news group or write to the DJGPP mailing
list <djgpp@delorie.com> and put into your message the description of
your calamity, the contents of the file `ENVIRON.LST', the output of
`go32-v2', the contents of your `AUTOEXEC.BAT' and `CONFIG.SYS', and
what GCC printed during compilation with the `-v' switch (if your
problem is that GCC won't work).
* If your problem involves a program that crashes and prints a stack dump,
please post that stack dump. It's best to run `symify' on the stack
dump, and post the output of `symify':
symify -o dumpfile yourprog
(*Note detailed description of symify: Crash traceback, for more details
about `symify.')
* Allow for 2-3 days (more on weekends) for all the reply messages to come
in, then act according to what they recommend.
Be warned that you might get several dozen messages in reply to your request;
this is not meant to overflow your mailbox or sabotage your relationship with
your system manager, it's just the usual friendly response of fellow
DJGPP'ers to your lonely cry for help. Some of the replies might suggest
what you already checked and reported in your original message, or even miss
the point altogether. Be ready for this and don't flame us for trying to
help you as much as we can.
File: djgppfaq.info, Node: Compiler performance, Next: Compiling, Prev: Trouble, Up: Top
7. Compiler and Linker Performance
**********************************
This chapter deals with speed of compilation and linking under DJGPP, and how
they could be improved.
If you already know whether the compiler or the linker is the slow part, go
to the appropriate section; if not, add `-v' to your GCC command line and run
it again. With the `-v' switch, GCC will print all the programs it invokes,
and you will be able to tell which one is taking most of the time.
* Menu:
* Slow compiler:: Are your compiles slow?
* Slow linker:: How to boost the linking speed.
File: djgppfaq.info, Node: Slow compiler, Next: Slow linker, Prev: Compiler performance, Up: Compiler performance
7.1 Slow Compilation
====================
**Q*: Why GCC is compiling sooo slooowww?*
*A* : That depends on what you mean by "slow". The following table gives
"normal" gcc compilation speed, in source lines per second, on a 486DX2-66:
| Without optimization | With -O2
-----------+------------------------+------------
C++ source | 200 | 100
-----------+------------------------+------------
C source | 430 | 250
(Btw, these numbers are about 20% faster than you will get on a 40MHz Sparc2
box.) On machines faster or slower than 486DX2-66, scale these numbers
appropriately. When comparing to this table, don't forget to count header
files your program `#include's' in the total line count. And *don't* check
compilation speed on very short programs (like the classic `"Hello,
world!"'), because the overhead of loading the multiple passes of the
compiler will completely hide the compiler performance.
If your results are close to these (deviations of a few percent are
considered "close" here), then that's as fast as you can get with GCC. If
they are *significantly* lower, you may indeed have a problem; read on.
First, check to see if GCC pages to disk when it compiles. This is
manifested by a heavy disk traffic which won't go away even if you have a
large write-back disk cache installed. To be sure, disable the virtual
memory services for your DPMI host (for `CWSDPMI', use the `CWSDPR0' as your
DPMI host, or get the `CWSPARAM' program and change the swap filename to
point to a non-existent drive), or use `PMODE/DJ' as the DPMI host, then run
the compilation again; if the compiler aborts with an error message saying
there isn't enough memory, then it *is* paging.
If paging does happen, you need to free more extended memory. If you have a
RAM disk, make it smaller, or don't use it at all (it only makes compiles run
about 10% faster), or make your disk cache smaller (but don't discard the
disk cache altogether); if you have other programs which use extended RAM,
make them use less of it. Failing all of the above, buy more RAM (*note the
description of reasonable configuration: Reasonable hardware.). Also see
*Note recommendations for optimal software configuration: Config.
If GCC doesn't page, check the settings of your disk cache. If you don't use
a cache, install one--this can slash your compilation times by as much as
30%, more so when compiling a large number of small files. If you already
have a cache, enable its delayed-write (aka write-back, aka staggered-write)
operation. Some people disable the delayed-write feature for safety reasons,
to avoid losing files due to system crashes. In such cases, you can usually
gain performance without sacrificing safety by enabling delayed-write
together with an option that causes the cache to flush the write-behind data
before the system returns to the DOS prompt. (For `SmartDrv' disk cache,
this is achieved by specifying `/N/F' switches instead of `/X'.) GCC usually
gains a lot when you set up your cache in such a way, because each compiler
pass (pre-processor, compiler, assembler) must write temporary files that are
used by the following passes.
If you had some of the beta releases of v2.0 installed during the
beta-testing period, be sure to upgrade your `CWSDPMI' to the latest version.
The memory allocation scheme has been changed halfway through the
beta-testing, which made old versions of `CWSDPMI' *awfully* slow when used
with programs linked against the new versions of the library.
It is also worthwhile to check the settings of your system BIOS. In
particular, the following items should be checked against your motherboard
vendor recommendations:
Internal and external CPU cache....set to Enable
CPU cache scheme...................set to Write-back, if possible
DRAM and SRAM wait states..........vendor-recommended optimal values
Incorrect or suboptimal settings of the above items can explain as much as
30% performance degradation on 486 machines, and as much as 500% (!) if you
have a Pentium CPU.
DJ Delorie <dj@delorie.com> reports that his well-tuned 166 MHz Pentium
system with 32 MBytes of RAM and 4 MBytes of RAM disk compiles the entire GCC
source in under 10 minutes (this takes about 45 minutes on a 40MHz Sparc2).
File: djgppfaq.info, Node: Slow linker, Prev: Slow compiler, Up: Compiler performance
7.2 Slow Linking
================
**Q*: The compiler finishes in a few seconds, but then the linker grinds away
for more than a minute, even on a very short program...*
*A* : Try linking the trivial `"Hello, world!"' program; it should take no
more than 7-10 seconds. If you see much slower linking on your system, then
the following advice might help you.
A few users have reported that they got much faster linking after they've
stub-edited `ld.exe' to change the transfer buffer size to 64KB. This
speedup effect is usually seen when DJGPP is installed on a networked drive,
or on a compressed disk; when DJGPP is installed on a local disk drive,
linking speed is not affected by the size of transfer buffer.
If you use a disk cache, make sure you enable its write-back (aka
delayed-write) operation. Some people disable the delayed-write feature for
safety reasons, to avoid losing files due to system crashes. In such cases,
you can usually gain performance without sacrificing safety by enabling
delayed-write together with an option that causes the cache to flush the
write-behind data before the system returns to the DOS prompt. For
`SmartDrv' disk cache, this is achieved by specifying `/N/F' switches instead
of `/X'.
For very large (several MBytes) executables which are built from a large
number of small source files, the link stage might be the one which needs
more RAM than you have free, and thus be the bottleneck of the time it takes
to build your program. Check that the size of the executable isn't larger
than the amount of your free RAM. If it is, then it might make sense to use
a smaller (or even no) disk cache, and allow the linker as much physical RAM
as it needs. Be sure that the linker wasn't stub-edited to make its transfer
buffer too small.
Another reason for slow linking might be that the `DJGPP.ENV' file by default
sets `TMPDIR' to a `tmp/' subdirectory of the main DJGPP installation
directory; if DJGPP is installed on a networked drive, this means all your
temporary files go back and forth through the network (and networked disks
are usually not cached on your PC). In such cases, setting `TMPDIR' to a
directory on your local drive, or to a RAM disk, would probably make linking
faster.
File: djgppfaq.info, Node: Compiling, Next: Running, Prev: Compiler performance, Up: Top
8. Compile-time and Link-time Problems
**************************************
Being of a Unix origin, GCC has a somewhat different flavor of command-line
syntax and its peculiar compilation and link algorithms. It also has a
plethora of optional switches, some of them obscure or semi-documented.
These are known to confuse users, especially those who had previous
experience with DOS-based C compilers.
This chapter explains how to solve some of those problems which tend to
appear when compiling and linking your programs.
* Menu:
* Missing headers/libraries:: GCC can't find header files/libraries.
* Missing C++ headers:: GCC can't find C++ header files.
* C++ comments:: Avoid C++ comments in C programs.
* Which language:: GCC resolves it by looking at filename
extensions.
* Objective C:: Can't use ObjC 2.6.0.
* DJGPP-specific:: How to write DJGPP-specific fragments.
* Unresolved externals:: Where are those library functions?
* Which library:: Which library has which functions?
* Libraries' order:: Which libraries to put first?
* Still unresolved:: C++ misses complex and iostream functions.
* Class Complex:: It is now a complex template class.
* Pure virtual:: Problems with pure virtual functions in C++.
* djgpp_first_ctor:: Why are these unresolved?
* Large image:: Static arrays bloat C++ program image.
* Large executable:: Why is DJGPP .EXE so large?
* Win95 LNK files:: These can cause DJGPP Linker to fail.
* No EXE:: Novell Netware fails STUBIFY.
* Large object files:: Linker fails for large objects/libraries.
File: djgppfaq.info, Node: Missing headers/libraries, Next: Missing C++ headers, Prev: Compiling, Up: Compiling
8.1 GCC can't find headers or libraries
=======================================
**Q*: When I run the compiler it says it couldn't find header files and/or
libraries. But the headers and libraries are all there, so why won't it find
them?*
**Q*: When I link my programs, ld.exe complains that it cannot open crt0.o,
although that file exists in the lib subdirectory...*
*A* : In order for the compiler to find its include files, libraries and
other stuff it can't do without, you should have the following variable set
in your environment:
set DJGPP=c:/djgpp/djgpp.env
and it should point to the correct path of the file `DJGPP.ENV' on your
system (the file itself comes with the file djdev200.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djdev200.zip in the DJGPP
distribution). In the above example it is assumed to be in the `C:/DJGPP'
directory, but you should set it as appropriate for your installation.
Sometimes, people make errors in their `AUTOEXEC.BAT' that cause the DJGPP
variable to be defined incorrectly, or not defined at all (some of the more
common causes are listed below). To check what is the actual setting, type
from the DOS prompt:
set > env.lst
then examine the contents of the file `env.lst'. You should see there a line
like this:
DJGPP=c:/djgpp/djgpp.env
If a line such as this isn't there, you should investigate the cause for this
(see below for some of the possibilities).
Many problems with setting DJGPP happen when people put excess blanks around
the `=' character, which has the effect of defining "DJGPP " (with the blank)
which is not the same as "DJGPP" (without blanks). You should make sure
there are no such excess blanks, or DJGPP won't find its files.
Another possible cause of DJGPP variable not being set is that you invoke
another batch file from your `AUTOEXEC.BAT' before the line that sets DJGPP.
Make sure such batch files are invoked with the `CALL' statement, because
otherwise the batch file will never return (that's a "feature" of DOS batch
file processing).
The code that processes `DJGPP.ENV' assumes that this file resides in the
main DJGPP installation directory. If that assumption is wrong, the compiler
(and some other DJGPP programs) might fail to find some of the files or
auxiliary programs they need. *Do NOT move DJGPP.ENV to any other directory!*
Note that if you run DJGPP under Win95, WinNT or any other environment that
supports long filenames (e.g., if DJGPP is installed on a networked drive
whose network redirector supports long filenames), you *cannot* use long
names of the directories in the pathname of `DJGPP.ENV' when you set the
above variable in the environment; you should use their 8+3 names instead.
First, some of these systems (such as WinNT) do not even support the LFN API
for DOS programs. But even if LFN API *is* supported, e.g. on Win95, DJGPP
won't know that it should support LFN until *after* it read `DJGPP.ENV'--it's
a chicken-and-egg problem. For example, the following setting *won't work*:
set DJGPP=c:/programs/Development/Djgpp/djgpp.env
If the DJGPP variable is set correctly, then check the following possible
causes of this misbehavior:
* You have edited the file `DJGPP.ENV' in a way that invalidated some of
the settings there; try restoring the original file from the
distribution to see if that fixes your problems. Be sure you are
familiar with the syntax of `DJGPP.ENV' before you edit it. The DJGPP
server has a page with a description of the DJGPP.ENV syntax, at this
URL:
http://www.delorie.com/djgpp/doc/kb/kb_7.html#SEC7
* Some older versions of Novell Netware cause the linker to fail if the
libraries or the startup file `crt0.o' reside on a networked drive.
This is due to a peculiarity of Novell that happens to fail the library
function `stat' in some cases. The exact reason of the failure has been
identified, and the next release of the library will include a version
of `stat' that works around that problem, so future releases of the
linker will be free of this bug. As a temporary work-around, move all
the libraries and `crt0.o' to a local drive. (1) (*note Missing
headers/libraries-Footnotes::) Another solution would be to upgrade your
Novell software; version 4.x is reportedly free of this problem.
* You renamed the `gcc.exe' driver to some other name. In this case, you
should edit the file `DJGPP.ENV' to add a section named after the new
name of GCC, which is an exact duplicate of the section called `[gcc].'
DJGPP start-up code uses this file to find environment variables which
it should put into the environment before your `main' function is
called, but it searches for the relevant variables using the actual name
of the program, so when you rename the executable, it can't find its
section and doesn't put the necessary variables into the environment.
* Your `FILES=' setting in `CONFIG.SYS' is insufficient, so GCC runs out
of available handles.
You should have at least `FILE=15' in your `CONFIG.SYS.'
* Your DJGPP directory is on a networked drive, and the network redirector
doesn't have enough available handles in its configuration.
Presumably, there should be a parameter in some configuration file or a
command-line argument to one of the network drivers which sets the number
of files that can be open simultaneously on a networked drive; you should
set it to be at least 15.
* You passed the `-B' switch to GCC. This overrides the default location
of `crt0.o' and if you follow `-B' with a directory other than that
where `crt0.o' resides, the linker won't find it.
You should not need to use the `-B' or `-L' switches at all if your
installation is correct and the `DJGPP' variable points to the main
installation directory, because GCC should be able to figure out all the
linker switches itself. If linking fails without explicit `-L' or `-B',
check out above for the possible causes.
File: djgppfaq.info, Node: Missing headers/libraries-Footnotes, Up: Missing headers/libraries
(1) Don't forget to add that directory to the `LIBRARY_PATH' line on
`DJGPP.ENV.'
File: djgppfaq.info, Node: Missing C++ headers, Next: C++ comments, Prev: Missing headers/libraries, Up: Compiling
8.2 GCC can't find C++ headers
==============================
**Q*: I installed all the packages, but GCC complains it can't find
`iostream.h', `_string.h' and other C++ headers. Where can I find those
header files?*
**Q*: GCC complains about being unable to find `Complex.h', `Regex.h' and
other header files which start with a capital letter, and I indeed don't see
them in my `lang/cxx/' directory. Where are they?*
**Q*: My C++ program needs header files whose filenames exceed the 8+3 DOS
filename restrictions, like `stdiostream.h' and `streambuf.h', and GCC cannot
find those files. How in the world can I write portable C++ programs??*
*A* : C++ include files are in the file lgp271b.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/lgp271b.zip. Files whose
names usually start with a capital letter, on MS-DOS have an underscore `_'
prepended so they can be distinguished from `complex.h', `regex.h' and the
like under case-insensitive DOS. Change `Complex.h' to `_complex.h' in your
source, and GCC will find them.
One possible cause for problems with C++ include files is that your source
file has a `.c' extension. GCC then thinks that this is a C program and
doesn't search the C++ include directories. Rename your file to `.cc' or
`.cpp' extension, or call GCC with the `-x c++' switch, and the header files
will be found. A full list of extension rules which GCC uses to determine
the source language can be found in the *Note list of language-specific
suffixes: Which language, elsewhere in this FAQ.
If you have problems with header files with long filenames, and you run under
Win95 or some other environment which allows for long filenames, try
disabling the "Long File Names" (LFN) support in DJGPP, by setting the `LFN'
environment variable to `No', like this:
set LFN=n
(DJGPP comes with LFN disabled by default on the `DJGPP.ENV' file, but you
might have enabled it.) If this makes the problems go away, then you have
some conflict between the way LFN is supported by DJGPP and your environment.
Under Win95, you must rename the files which should have long filenames to
those long names (as opposed to the truncated names you find in the DJGPP
archives). You must also set the option in the Win95 registry which disables
name-munging of the files which have exactly 8 characters in their name part.
This is how:
* From the "Start" menu select "Run" and type `regedit', to start the
Registry Editor.
* Expand the `HKEY_LOCAL_MACHINE' branch of the registry until you see in
the left pane an item called
`HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\FileSystem', then
click on it.
* The right pane now shows the list of values assigned to the `FileSystem'
key. If you don't see an item there called `NameNumericTail', select
"New", "Binary Value" from the "Edit" menu, then type `NameNumericTail'
and it will appear. Now double-click on `NameNumericTail' and enter a
value of 0.
* Restart Windows 95.
If the `NameNumericTail' set to 0 breaks some programs, you can restore its
original setting after you've renamed the files as described above.
`NameNumericTail' only affects the short names of new files being created, it
has no effect on the files that already exist.
File: djgppfaq.info, Node: C++ comments, Next: Which language, Prev: Missing C++ headers, Up: Compiling
8.3 GCC barfs on C++-style comments in C programs
=================================================
**Q*: My C program compiles OK with Borland's C, but GCC complains about
"parse error before `/' " at a line where I have a "//"-style comment.*
*A* : That's because // isn't a comment neither in ANSI C nor in K&R C.
Borland and Microsoft C compilers support it as an extension. GCC also
supports this extension (beginning with version 2.7.0), but using the `-ansi'
or `-traditional' switches to GCC disables this extension. In general, it's
a bad practice to use this extension in a portable program until such time as
the ANSI C standard includes it. If it's a C++ program, then rename it to
have a suffix which will cause gcc to compile it as such (*note list of
language-specific suffixes: Which language.), or use `-x c++' switch. If
it's a C program, but you want to compile it as C++ anyway, try `-x c++'; it
can help, but can also get you in more trouble, because C++ has its own
rules. For example, the following program will print 10 if compiled as a C
program, but 5 if compiled as C++:
#include <stdio.h>
int
main ()
{
printf ("%d \n" 10 //*
/ 2 //*/
1
);
return 0;
}
(While admittedly perverse, this little monstrosity was written with the sole
purpose of demonstrating that C and C++ have quite different semantics under
certain circumstances.)
If you must have both `-ansi' and C++-style comments, you can use the
`-lang-c-c++-comments' preprocessor switch. Gcc doesn't accept the
`-lang-XXX' switches on its command line, so you will have to use the `-Wp'
option, like this:
gcc -c -Wp,-lang-c-c++-comments myprog.c
Alternatively, you can add `-lang-c-c++-comments' to the `*cpp:' section of
your `lib/specs' file (but that will make it permanent).
Bottom line: until the future ANSI/ISO C standard includes this as part of
the C language, it's best to change those comments to C-style ones, if you
really mean to write a C program. The following `Sed' command will convert a
C program with C++-style comments into a valid C source, provided you don't
have the string "//" in a character string:
sed "s?//\(.*\)?/*\1 */?" file.c > newfile.c
Sed can be found in the DJGPP distribution, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed118b.zip.
File: djgppfaq.info, Node: Which language, Next: Objective C, Prev: C++ comments, Up: Compiling
8.4 How does GCC recognize the source language?
===============================================
**Q*: I type `GCC PROG.CC' and GCC complains that it can't recognize
`PROG.CC''s file format. How come a C++ compiler doesn't recognize a C++
source??*
**Q*: I type `GCC PROG.C' to compile a C program which I already remember to
pass compilation without a single warning, and suddenly it gives all kinds of
strange error messages and unresolved externals.*
*A* : That's because you typed your source file extension in *upper* case.
GCC is *not* case-insensitive about filenames like DOS is, and it uses the
file's extension to determine how to compile a file. Valid extensions are:
`.cc'
`.cxx'
`.cpp'
C++ source (passed through cpp).
C source that must be passed through cpp first.
Raw C source (no cpp pass).
`.ii'
Raw C++ source (not to be preprocessed).
Objective-C source.
Assembler that must be passed through cpp first.
Raw assembler source (no cpp pass).
Any other file is passed to the linker, under the assumption that it's an
object file.
In the examples above, `PROG.C' is taken as a C++ program, not a C one, and
`PROG.CC' is passed to the linker as if it were an object file. You can see
what GCC does by adding the `-v' switch to the GCC command line; if you see
that it's invoking `cc1plus.exe' (the C++ compiler) instead of `cc1.exe' (the
C compiler), or calling `ld.exe' (the linker) on a source file, then you'd
know this is your problem. If you have problems keeping up with the verbose
GCC output caused by `-v', see *Note how to capture GCC output: Redirect, in
this FAQ.
You can override the default rules gcc uses to decide how each input file
should be treated, with the help of the `-x LANGUAGE' switch. For instance,
the command
gcc -x c++ prog.c
compiles `prog.c' as C++ source. *Note -x LANGUAGE switch description:
(gcc)Overall Options, for more info on `-x' options.
File: djgppfaq.info, Node: Objective C, Next: DJGPP-specific, Prev: Which language, Up: Compiling
8.5 Problems with Objective C
=============================
**Q*: How do I tell gcc my .cc file is to be compiled as Objective-C source?*
**Q*: I compile an Objective-C program, but get unresolved symbols.*
**Q*: I can't compile the Objective-C test program which came with DJGPP.*
*A* : Give your sources the `.m' extension, or use `-x objective-c' switch
to GCC, so it will *know* you mean to compile with Objective C.
Objective-C was broken in GCC 2.6.0. The problem manifests itself by
unresolved modules. If you use that version, you'll have to upgrade to
version 2.6.3 or higher.
File: djgppfaq.info, Node: DJGPP-specific, Next: Unresolved externals, Prev: Objective C, Up: Compiling
8.6 Writing codes fragments which are specific to DJGPP
=======================================================
**Q*: I must put a DJGPP-specific code fragment into my program. What symbol
should I use in the `#ifdef' directive to make it only visible under DJGPP?*
*A* : Use `__DJGPP__', like this:
#ifdef __DJGPP__
... DJGPP-specific code ...
#else
... not seen under DJGPP ...
#endif
`__DJGPP__' has the value of the DJGPP major revision number, so you can
write code fragments which have different behavior under different versions
of DJGPP:
#ifdef __DJGPP__
#if __DJGPP__ > 2
.... will work only in DJGPP v3.x and later ...
#else
.... get here for DJGPP v2.x ...
#endif
#else
.... get here in DJGPP v1.x or non-DJGPP environment
#endif
Another DJGPP-specific pre-processor symbol which DJGPP defines is
`__GO32__'; but it is only provided for compatibility with previous versions
of DJGPP (v1.x) and its use should be discouraged.
File: djgppfaq.info, Node: Unresolved externals, Next: Which library, Prev: DJGPP-specific, Up: Compiling
8.7 Unresolved externals when linking programs
==============================================
**Q*: Why do I get so many unresolved symbols when linking my programs?*
*A* : By default, GCC instructs the linker to only look in two libraries:
`libgcc.a' and `libc.a.' Some functions aren't included there, so the linker
can't find them. GPL library routines, like obstack and regex packages are
in `libgpl.a' library; append `-lgpl' to the link command line to use them.
To use C++ classes in the `libgpp.a' (it's called `libg++.a' on Unix
systems), append `-lgpp.' The Standard C++ Template classes are in
`libstdcx.a' (it's called `libstdc++.a' on Unix); append `-lstdcxx.'
When linking C++ programs, you can use the `gxx' instead of `gcc' command; it
will then instruct the linker to also scan the C++ libraries automatically,
so you don't have to remember doing that yourself.
Note that the first release of DJGPP v2.0 didn't include `gxx.exe' and the
C++ STL library `libstdcx.a.' If you cannot find them on your machine,
download the latest `gcc272b.zip' and `lgp271b.zip' archives that are dated
22-Feb-96 or later.
If your program uses a lot of floating-point math, or needs math functions
beyond those specified in the ANSI/ISO standard, consider appending `-lm' to
your link command line. The basic math functions required by ANSI/ISO
standard are included in the `libc.a' library, but `libm.a' includes higher
quality versions of these functions, and also some functions not included in
the default library, like Gamma function and Bessel functions.
File: djgppfaq.info, Node: Which library, Next: Libraries' order, Prev: Unresolved externals, Up: Compiling
8.8 How not to lose your head with all these libraries
======================================================
**Q*: I'm lost with all those different libraries. How in the world can I
find out which functions are included in which library?*
*A* : You can use the `nm' program to check what functions are included in a
library. Run it with the `-C' option and with the library as its argument
and look in the output for the name of your function (the `-C', or
`--demangle' option makes the function names look closer to what they are
called in the source file). Functions which have their code included in the
library have a capital `T' before their name. For example, the following is
a fragment from the listing produced by `nm':
c:\djgpp\lib> nm --demangle libc.a
.
.
.
stdio.o:
000000e4 b .bss
000000e4 d .data
00000000 t .text
00000098 t L12
0000001e t L3
00000042 t L6
0000004d t L7
0000006a t L9
00000000 t __gnu_compiled_c
U _filbuf
U _flsbuf
00000000 T clearerr
000000ac T feof
000000c2 T ferror
000000d8 T fileno
0000000c T getc
00000052 T getchar
0000002a T putc
0000007c T putchar
00000000 t gcc2_compiled.
.
.
.
Here we see that the module `stdio.o' defines the functions `clearerr',
`feof', `ferror', `fileno', `getc', `getchar', `putc' and `putchar', and
calls functions `_filbuf' and `_flsbuf' which aren't defined on this module.
Alternatively, you can call `nm' with the `-s' or `--print-armap', which will
print an index of what symbols are included in what modules. For instance,
for `libc.a', we will see:
c:\djgpp\lib> nm --print-armap libc.a
.
.
.
_feof in stdio.o
_ferror in stdio.o
_fileno in stdio.o
.
.
.
which tells us that the functions `feof', `ferror' and `fileno' are defined
in the module `stdio.o.'
`nm' is fully described in the GNU docs. *Note the Binutils package docs:
(binutils)nm.
File: djgppfaq.info, Node: Libraries' order, Next: Still unresolved, Prev: Which library, Up: Compiling
8.9 DJGPP uses a one-pass linker
================================
**Q*: I give all the libraries to gcc, but I still get unresolved externals
when I link. What gives?*
*A* : `Ld' is a one-pass linker: it only scans each library once looking
for unresolved externals it saw *until that point*. This means the relative
position of object files and libraries' names on the command line is
significant. You should put all the libraries *after* all the object files,
and in this order:
-lgpp -lstdcxx -lgpl -lm
E.g., to link files main.o and sub.o into a C++ library, use the following
command line:
gcc -o main.exe main.o sub.o -lgpp -lstdcxx -lgpl
or, if you compile and link in one command:
gcc -o main.exe main.cc sub.cc -lgpp -lstdcxx -lgpl -lm
If you have any libraries of your own, put them *before* the above system
libraries, like this:
gcc -o main.exe main.cc sub.cc -lmylib -lgpp -lstdcxx -lgpl -lm
When you use the `gxx' compilation driver to compile a C++ program, it names
the C++ libraries in the correct order.
If your installation tree is different from the default, i.e., if you keep
the libraries *not* in the default `lib/' subdirectory, then you should add
that directory to the line in the `[gcc]' section of your `DJGPP.ENV' file
which starts with `LIBRARY_PATH', or put into your environment a variable
called `LIBRARY_PATH' and point it to the directory where you keep the
libraries. Note that if you invoke the linker by itself (not through the gcc
driver), then `LIBRARY_PATH' will have no effect, because this variable is
only known to the gcc driver. So if you must call `ld' directly, use the
`-L' option to tell it where to look for the libraries.
File: djgppfaq.info, Node: Still unresolved, Next: Class Complex, Prev: Libraries' order, Up: Compiling
8.10 C++ functions still not found
==================================
**Q*: I put all the libraries in the above order, but the linker still can't
find some C++ functions from `complex.h' and `iostream.h.'*
*A* : These functions are declared `inline' and defined on these header
files. However, GCC won't inline them unless you compile with optimizations
enabled, so it tries to find the compiled version of the functions in the
library. Workaround: compile with `-O.'
File: djgppfaq.info, Node: Class Complex, Next: Pure virtual, Prev: Still unresolved, Up: Compiling
8.11 Where is class Complex?
============================
**Q*: I cannot use class Complex in v2! My C++ program compiled fine with
DJGPP v1.x, but in v2 the linker complains that it cannot find Complex class
definitions in the library. Where are they?*
**Q*: I looked into libgpp.a and there aren't any references to any Complex
class functions. I also didn't find complex.cc source file in the source of
Libg++ library. Where did the Complex class go?*
*A* : The latest Draft C++ Standard has changed its notion of complex
numbers, and the latest versions of Libg++ have followed suit. Instead of
`class Complex' there is now a *template* `class complex<double>', and
`Complex' is now a typedef which uses that template class. Look into the
headers `lang/cxx/_complex.h' and `lang/cxx/std/complext.h' and you will see
that change. Part of the code found previously on `complex.cc' in the Libg++
source distribution is now found on `cdinst.cc' source file in the STL
sources (look inside `libstdcx.a'), another part is scattered between the
various files included at compile time (such as `lang/cxx/std/dcomplex.h' and
`lang/cxx/std/complext.cc'), while the rest is generated by the compiler
itself. Therefore, there aren't any predefined functions of class Complex in
`libgpp.a.' Programs that use class Complex need to be edited to replace every
instance of `class Complex' to either just `Complex' or `class
complex<double>.'
As long as the C++ Standard is not officially published, C++ is still a
moving target, and Libg++ releases that try to track it sometimes have no
other alternative but to break existing code. If you use C++, you have to
accept this as a fact of life.
File: djgppfaq.info, Node: Pure virtual, Next: djgpp_first_ctor, Prev: Class Complex, Up: Compiling
8.12 The linker complains about __pure_virtual function.
========================================================
**Q*: When I link a C++ program, the linker complains about "__pure_virtual"
being an unresolved symbol. What should I do?*
*A* : This problem is caused by a `libgcc.a' library which lacks a module
called `___pure_virtual' (yes, with *three* leading underscores!). You
should get an updated version of that library which includes such a module.
`libgcc.a' comes with the Gcc distribution, so look in the latest
`gccNNNb.zip' file.
If, for some reason, you cannot find `libgcc.a' with that module, you can add
it yourself. To this end, create a file called `pure.c' with this content:
#define MESSAGE "pure virtual method called\n"
void __pure_virtual()
{
write(2, MESSAGE, sizeof(MESSAGE) - 1);
_exit(-1);
}
Compile this file and put the object file into `libgcc.a', like this:
gcc -c pure.c
ar rvs libgcc.a pure.o
That's all!
File: djgppfaq.info, Node: djgpp_first_ctor, Next: Large image, Prev: Pure virtual, Up: Compiling
8.13 Unresolved djgpp_first_ctor
================================
**Q*: I do everything like your praised FAQ says, but the linker complains
about unresolved symbols with strange names like `djgpp_first_ctor',
`djgpp_last_dtor', etc. I looked in every library with `nm', and I cannot
find these creatures. Where in the world are they??*
*A* : These symbols are defined by the `djgpp.lnk' linker script that should
be in your `lib/' subdirectory. When you call `gcc' to link a program, it
invokes `ld.exe' with the option `-Tdjgpp.lnk.' If you invoke `ld' directly
(this is generally not recommended), be sure to include that switch. If you
did invoke it through `gcc', maybe your linker is set up incorrectly. Add
`-v' to the GCC switches and check that the command line that GCC gives to LD
includes that switch, that your `lib/' subdirectory includes that script
file, and that the script file is intact and includes the definition of the
above symbols.
Another reason might be that you have edited your `DJGPP.ENV' file in a way
that prevents the linker from finding its `djgpp.lnk' script.
Mixing an old v1.x installation with a v2.x one can also cause such problems.
Be sure to delete the entire v1.x tree, or rename it, before installing the
v2.x distribution.
File: djgppfaq.info, Node: Large image, Next: Large executable, Prev: djgpp_first_ctor, Up: Compiling
8.14 C++ programs yield large `.exe' file
=========================================
**Q*: It seems that declaring a large `static' array has the effect of
bloating the program image on disk by that many bytes. Surely there is a
more compact way of telling the loader to set the next N bytes of RAM to
zero?*
*A* : This only happens in C++ programs and is a (mis-)feature of GCC. You
can use the `-fconserve-space' switch to GCC to prevent this from happening,
but it also turns off the diagnostics of duplicate definitions, which, if
uncaught, might cause your program to crash. Thus, this switch isn't
recommended for programs which haven't been completely debugged (if there is
such a creature). The `-fconserve-space' switch is described in the GCC
docs, *Note GNU C Compiler docs: (gcc)C++ Dialect Options.
If the downside of using this switch doesn't deter you, you can even add this
switch to your `lib/specs' file to make it permanent.
File: djgppfaq.info, Node: Large executable, Next: Win95 LNK files, Prev: Large image, Up: Compiling
8.15 Why are DJGPP `.exe' files so large?
=========================================
**Q*: I compiled a trivial "Hello world" program and got a 32KB executable
file. That's ridiculously bloated!*
**Q*: How come I recompile my programs with v2, and my executables become
larger by some 20-30 KBytes? Isn't the latest version supposed to be better?*
*A* : In general, v2 programs are about 20-30K larger on disk, but use
50-120K less memory at run-time, than v1.x programs. The larger disk image
is due to two main factors:
* Part of the code that used to be inside `go32' is now part of the
library and thus gets linked into every program.
* The v2 startup code is much more powerful, but also larger.
Judging code sizes by looking at the size of "Hello" programs is meaningless,
since most of the power of protected-mode programming goes wasted in such
programs. There is no point in switching the processor to protected mode
(which requires a lot of code) just to print a 15-byte string and exit. The
overhead induced by the code needed to set up the protected-mode environment
is additive; the larger the program, the smaller the overhead relative to the
program size.
Apart from getting to protected-mode, the DJGPP startup code also includes
such functionality as command-line argument expansion, long command-line
support, and loading the environment from a disk file; these usually aren't
available with other DOS protected-mode compilers. Exception handling, FPU
detection and emulator loading, which were part of `go32' in v1.x, are now
also part of the startup code.
If your program doesn't need parts of the startup code, it can be made
smaller by defining certain functions with empty bodies. These functions are
`__crt0_glob_function', `__crt0_load_environment_file', and
`__crt0_setup_arguments.' By defining empty substitutes for all three of
these, you can make the "Hello" program be 18KB on disk.
You can make your program image still smaller by compressing it with `DJP'
which is a DJGPP-specific executable compressor, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/mlp104b.zip. It is fast
and has no memory overhead.
And of course, don't forget to link with `-s' switch to `gcc', or to run
`strip' on the COFF output of the linker. This strips off the debugging
symbols and makes the executable quite a lot smaller (not recommended except
when distributing production programs, because this makes debugging very hard
indeed).
Another cause for differences in executable sizes between v1.x and v2 might
be the code generated by GCC: DJGPP v2 uses a newer version of GCC. Usually,
the code size is quite similar, but in some cases GCC 2.7.2 has been seen to
produce code which is 50% larger or 50% smaller than GCC 2.6.3 included with
v1.12.
File: djgppfaq.info, Node: Win95 LNK files, Next: No EXE, Prev: Large executable, Up: Compiling
8.16 Linker complains about `djgpp.lnk'
=======================================
**Q*: I run DJGPP under Windows 95, but the linker complains about
`djgpp.lnk' file...*
*A* : Do you have a shortcut to DJGPP in your current directory? If so, and
if you call that shortcut `djgpp', Windows will create a file `djgpp.lnk' in
your working directory. In that case, when `ld.exe' looks for its linking
script, it will find this file instead, and will be totally confused by its
format and contents.
File: djgppfaq.info, Node: No EXE, Next: Large object files, Prev: Win95 LNK files, Up: Compiling
8.17 Linker fails to produce the EXE program under Novell
=========================================================
**Q*: When I link my program, it fails to produce the .EXE executable, but
only if I do this on a networked drive...*
**Q*: I run STUBIFY on a networked drive under Novell, but it doesn't produce
a .EXE file. How come?*
*A* : You might have another copy of the file with the same name that GCC is
creating in another directory somewhere on your networked drive. If that
other directory is on your PATH, it is searched by Novell when the linker and
`STUBIFY' try to create the executable file, because that file doesn't exist
in the current directory. So what might actually happen is that the linker
and `STUBIFY' are overwriting the files they find on your PATH instead of
creating new files in the current directory.
You can verify that this indeed is the problem by searching your networked
disks for files with the same name as those you are trying to build, and
looking at their time stamps. If that is indeed the problem, then you have
several possible ways of solving it:
1. You can remove the other files, rename them, or move them to another
directory that isn't searched by Novell.
2. You can rename the program you are trying to link.
3. You can change the way Novell searches for files (aka "the search
mode"), so that it won't look in the directories on your PATH.
4. You can change your access rights to the directory on the PATH where the
other files reside, so that you won't have write privileges to that
directory.
5. You can change the search mode for `STUBIFY' and the linker (or for any
other program that gives you that trouble) by running commands like
these:
SMODE stubify.exe 2
SMODE ld.exe 2
File: djgppfaq.info, Node: Large object files, Prev: No EXE, Up: Compiling
8.18 Linker fails for large object files or large libraries
===========================================================
**Q*: Whenever I define very large static arrays in my program, the linker
fails saying "could not read symbols: Bad value". Huh??*
**Q*: I have some large libraries that I cannot link because the linker fails
on them with a message saying "memory exhausted". I have plenty of virtual
memory on my system, so why would ld fail?*
*A* : This is a known bug in `ld.exe' from GNU Binutils 2.5.2. Until it is
corrected in some future version, these are your alternatives for a
work-around:
* In case of a large library, split it into several smaller ones.
* For a module that defines large data structures, move some of the static
data to other files, or allocate the space at runtime with `calloc.'
File: djgppfaq.info, Node: Running, Next: Graphics, Prev: Compiling, Up: Top
9. Running Compiled Programs
****************************
This chapter discusses various problems which may happen when running DJGPP
programs under different environments, and gives solutions to them.
* Menu:
* v2.x crash:: Program which was OK in v1.x bombs in v2.0.
* Crash traceback:: How to make sense out of stack dumps.
* File data corrupted:: The DOS *TEXT*/*BINARY* file issue.
* Screen I/O:: Beware of the buffering!
* Distributing:: DJGPP programs are *not* self-contained.
File: djgppfaq.info, Node: v2.x crash, Next: Crash traceback, Prev: Running, Up: Running
9.1 My program crashes only in v2.0!
====================================
**Q*: I have this program which runs fine when compiled with DJGPP v1.12, but
crashes and burns in v2.0. Isn't it obvious that you guys blew it with v2.0?*
**Q*: My v2.0 program crashes, but only under CWSDPMI; it runs OK under other
DPMI hosts like Windows, OS/2 or QDPMI. Is this a bug in CWSDPMI?*
*A* : Not necessarily so, it could still be a bug in your program which just
went unnoticed in v1.12. One area where such things can happen is use of
uninitialized memory. In v1.x, memory first allocated to the stack or by a
call to `malloc' is always zeroed, but v2.0 doesn't behave this way, so your
program might exhibit erratic behavior or crash with `SIGSEGV' because of
such bugs. In particular, if the program behaves differently depending on
which program was run before it, you might suspect bugs of this kind.
To check whether this is the source of your grief, include the header
`crt0.h' in your `main' and set `_crt0_startup_flags' to
`_CRT0_FLAG_FILL_SBRK_MEMORY'; this will fill the memory with zeroes when it
is first allocated. If the program will run OK after recompilation, then
this is probably the cause of your problem. To make spotting uninitialized
memory simpler, you can set `_crt0_startup_flags' to
`_CRT0_FLAG_FILL_DEADBEAF' (don't laugh!); this will cause the sbrk()'ed
memory to be filled with the value `0xdeadbeaf' (`-559838801' in decimal)
which is easy to spot with a debugger. Any variable which has this value was
used without initializing it first.
Another possible cause of problems will most probably be seen only under
CWSDPMI; its telltale sign is a message "Page fault at ..." that is printed
when a program crashes, and an error code of 6. Unlike other DPMI hosts,
CWSDPMI supports some DPMI 1.0 extensions which allow DJGPP to capture and
disallow illegal dereference of pointers which point to addresses less than
1000h (aka "NULL pointer protection"). This feature can be disabled by
setting the `_CRT0_FLAG_NULLOK' bit in `_crt0_startup_flags'; if this makes
SIGSEGV crashes go away, your program is using such illegal pointers; the
stack trace printed when the program crashes should be a starting point to
debug this.
An insufficient stack size can also be a cause of your program's demise, see
*Note setting the stack size: Stack size, below.
File: djgppfaq.info, Node: Crash traceback, Next: File data corrupted, Prev: v2.x crash, Up: Running
9.2 What is that gibberish printed when my program crashes?
===========================================================
**Q*: My program dies with a cryptic message like "Segmentation violation" or
"Unsupported DOS request" or "General Protection Fault" and prints some
funny-looking numbers. Can't I get some decent human-readable traceback
information, so I could pinpoint where in the program did the problem happen?*
*A* : Those "funny-looking numbers" *are* the traceback. They describe the
sequence of function calls which led to the fatal error by giving you the
addresses where each function was called. You can have these addresses
translated to source line numbers by using the `SYMIFY' program (it is
included in the djdev200.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djdev200.zip, and should be
in your `bin/' subdirectory). To this end, make sure that your program was
compiled with the `-g' switch, linked *without* the `-s' switch and *not*
stripped, and that you have the source files available in your current
directory. Now invoke your program and do whatever it takes to make it
crash. Then, with the traceback still on the screen, type this from the DOS
command line:
symify your-program-name
You will see the list of source files and line numbers right next to their
hex addresses. Now you can start debugging.
You can ask `SYMIFY' to put the stack trace into a file (so you can consult
it later, e.g., from your editor while fixing the bug), by giving it an
output file, like this:
symify -o problem.dmp yourprog
You can also save the raw stack trace (without source info) to a disk file
and submit it to `SYMIFY' later, like this:
symify -i core.dmp yourprog
This comes in handy when your program grabs the screen (e.g., for some
graphics) and the stack trace can't be seen. You can then *Note redirect the
stack trace to a file: Redirect, e.g., with the `REDIR' program which comes
with DJGPP.
But what if you *didn't* compile your program with `-g', and you aren't sure
how to recreate the problem which crashed it, after you recompile? Well, you
can submit the stack dump *after* you recompile your program. Just press
that PrintScreen key or otherwise save the stack trace, then submit it to
`SYMIFY' from a file as described above, after you've recompiled the program.
Be sure to give gcc all the compilation switches (sans `-s') that you gave
it when you originally compiled your program (in addition to `-g'), including
the optimization switches, or else the addresses shown in the stack trace
might be invalid.
File: djgppfaq.info, Node: File data corrupted, Next: Screen I/O, Prev: Crash traceback, Up: Running
9.3 Reading and writing binary files
====================================
**Q*: I'm reading/writing data files, but the data gets corrupted.*
**Q*: When I read a file I get only a small portion of it.*
*A* : Are your data files binary? The default file type in DOS is "text",
even when you use the `read' and `write' library functions. Text files get
their Newlines converted to <CR>-<LF> pairs on write and vice versa on read;
reading in "text" mode stops at the first <^Z> character. You must tell the
system that a file is binary through the `b' flag in `fopen', or `O_BINARY' in
`open', or use the `setmode' library function.
You can also use the low-level `_read' and `_write' library functions which
give you the direct interface to the DOS file I/O.
File: djgppfaq.info, Node: Screen I/O, Next: Distributing, Prev: File data corrupted, Up: Running
9.4 Buffered screen I/O surprises
=================================
**Q*: My program prompts the user to enter data from the keyboard, then reads
its response. When compiled with a 16-bit compiler like BCC or MSC it works
as expected, but with gcc the prompt doesn't show, or is printed much later
in the program.*
**Q*: Help! I cannot make `gotoxy' work! The text I print appears on the
screen in incorrect locations after I use `gotoxy'!*
**Q*: Why does the text appear in the default colors even though I call
`textcolor' and `textbackground'?*
*A* : Do you write to screen using buffered I/O (`fprintf', `fputs' and the
like) functions, or send your output to the C++ `cout' stream? Then what you
see is the effect of the buffering of the standard output streams. The
buffer is not written to screen until it's full, or until a Newline is
output, which might produce very unpleasant and unexpected behavior when used
in interactive programs.
It is usually a bad idea to use buffered I/O in interactive programs; you
should instead use screen-oriented functions like `cprintf' and `cputs.' If
you must use buffered I/O, you should be sure that both `stdout' and `stderr'
are line-buffered or unbuffered (you can change the buffering by calling the
`setvbuf' library function); another solution would be to `fflush' the output
stream before calling any input function, which will ensure all pending
output is written to the operating system. While this will work under DOS and
DJGPP, note that some operating systems (including some DOS extenders) might
further buffer your output, so sometimes a call like `sync' would be needed
to actually cause the output be delivered to the screen.
The functions that set text attributes only affect the screen-oriented output
(aka "conio") functions (`cputs', `cprintf' etc.), the text written by
`fprintf' and other "stdio" functions doesn't change. This is unlike some
16-bit DOS compilers where `stdio' functions can also print colored text.
File: djgppfaq.info, Node: Distributing, Prev: Screen I/O, Up: Running
9.5 What do DJGPP programs need to run?
=======================================
**Q*: When I copy my DJGPP application program to another PC where no DJGPP
is installed, I can't run it. It complains that it cannot find DPMI (??).
Do I really need all of your multi-megabyte installation to run compiled
programs?*
*A* : No, you don't. You can either (1) bring the `CWSDPMI.EXE' free DPMI
host to the target machine and put it in the same directory as your compiled
program or somewhere along the `PATH', or (2) install another DPMI host (such
as QDPMI, 386Max, Windows, etc.) on the target machine. Note that the author
of CWSDPMI, Charles Sandmann <sandmann@clio.rice.edu>, requests a
notification by mail or acknowledged e-mail in case you distribute CWSDPMI
with a commercial or shareware product.
If your program could be run on a machine which lacks a floating-point
processor, you should also distribute an emulator, or link your program with
an emulator library. *Note floating-point emulation issues: Emulation.
Future DJGPP releases might have a way to bind your executable with `CWSDPMI'
to produce a stand-alone program. If you need such a feature *now* and if
you need it *badly*, write to Charles Sandmann <sandmann@clio.rice.edu> and
ask him about a modified stub code that creates an image of CWSDPMI if none
is found first time the program is run.
You can bind `PMODE/DJ' with your program, but remember that `PMODE/DJ'
doesn't support virtual memory, so such programs will only run on machines
with enough free physical RAM.
File: djgppfaq.info, Node: Graphics, Next: Floating point, Prev: Running, Up: Top
10. Writing and Running Graphics Programs
*****************************************
This chapter discusses some problems and explains some subtle points related
to graphics programming under DJGPP.
A tutorial is available on graphics programming with DJGPP, at this URL:
http://remus.rutgers.edu/~avly/djgpp.html
* Menu:
* Which driver:: What driver to use with your SVGA?
* Direct access:: Under protected-mode it is (almost) forbidden.
* GRX and Windows:: Windows can mess up your graphics screen.
File: djgppfaq.info, Node: Which driver, Next: Direct access, Prev: Graphics, Up: Graphics
10.1 What GRX driver to use with your SVGA
==========================================
**Q*: Why won't GRX work with my SVGA adapter in any resolution but the
standard VGA?*
**Q*: How do I tell GRX which driver to use with my SVGA?*
*A* : In order for GRX to work with your SVGA, you should set the `GRX20DRV'
environment variable, like this:
set GRX20DRV=et4000 gw 1024 gh 768 nc 256
To set that variable, you need to know the chip-set on your adapter; refer to
your SVGA documentation. Currently, GRX supports the following chip-sets:
`ati28800'
The ATi 28800 chip-set.
`cl5426'
Cirrus Logic CL-GD5426 or higher (like CL-GD5428) chip-set.
`et4000'
Tzeng Labs ET4000 chip-set.
`mach64'
The ATi Mach-64 SVGA.
`stdega'
The standard EGA adapter.
`stdvga'
The standard VGA adapter.
`VESA'
For any VESA-compatible adapter.
After you set the `GRX20DRV' variable, run `modetest.exe' to see what modes
you have available.
If your chip-set is not one of the above, try the `VESA' driver because many
adapters support the VESA BIOS extensions. If yours doesn't, try installing
a VESA BIOS emulator, like UNIVBE, e.g.
ftp://ftp.coast.net/Coast/msdos/graphics/univbe51.zip.
File: djgppfaq.info, Node: Direct access, Next: GRX and Windows, Prev: Which driver, Up: Graphics
10.2 Accessing the video memory
===============================
**Q*: I try to access the video memory at `0xa0000', but get "Segmentation
violation" ...*
**Q*: How can I access the text-mode video memory of my VGA?*
*A* : Absolute addresses of memory-mapped devices are mapped differently
under DJGPP than what you might be used to under other DOS development
environments. That's because DJGPP is a protected-mode environment, in which
you can't just poke any address: that's what protected mode is all about!
To access such absolute addresses, use the so-called "farptr" functions like
`_farpeekb' and `_farpokew'; they are described in the C Library reference.
*Note more details on using "farptr" functions to access absolute addresses
in low memory: Xfer, below.
For text-mode screen updates, you can also use the `ScreenUpdate' and
`ScreenUpdateLine' library functions to quickly update the screen from a text
buffer.
Using the `_farpeekX/_farpokeX' paradigm to access memory isn't much slower
than direct access (they compile into 2 machine instructions when
optimizations are enabled). But if you need even faster access (and don't
want to write it in assembly), *Note using the "nearptr" access facilities:
Xfer, as described below.
If your video card supports the VBE 2.0 standard, you can access the linear
frame buffer as a normal array in memory. For an example of such a
technique, see the VBE example code by Charles Sandmann, e.g.
ftp://ftp.neosoft.com/pub/users/s/sandmann/vbe.zip. You can also reach this
file via the Web, at this URL:
http://www.rt66.com/~brennan/djgpp/vbe.zip
File: djgppfaq.info, Node: GRX and Windows, Prev: Direct access, Up: Graphics
10.3 Graphics screen restoring under Windows
============================================
**Q*: When I switch away from my DJGPP program under Windows, then switch
back to it, graphics mode is down, or my screen is all messed up. Why?*
*A* : Windows only saves the VGA screen in standard VGA modes (1..13h) when
you switch away from a DOS application. In any other mode it only
saves/restores the video mode *number*, but not the actual screen contents.
Your application is most likely still in the proper video mode (if not, it's
probably the fault of the Windows driver for your SVGA card), but the video
memory is messed up. The beauty of all this is that your program has no way
of knowing that the screen has been taken away and then returned to it.
The only reasonable thing to do is to dedicate a "hotkey" in your application
(e.g., `Alt-R') whose action is to redraw the entire screen. If you do that,
it's best to start all the way from the beginning, with a call to
`GrSetMode', as there are a few bad Windows video drivers which do not
restore SVGA graphics modes properly upon the switch back.
File: djgppfaq.info, Node: Floating point, Next: Debugging, Prev: Graphics, Up: Top
11. Floating Point Issues and FP Emulation
******************************************
This chapter deals with issues pertaining to floating-point code and
floating-point emulation under DJGPP.
* Menu:
* Emulation:: What are your emulation options.
* Other emulators:: You can't use them.
* OS/2 emulation:: It doesn't serve DJGPP programs.
* -msoft-float:: This GCC switch isn't supported.
* Numeric exceptions:: Don't give us these NaN's!
* Emulator accuracy:: Not always as good as we'd like.
* SIGFPE with ObjC:: Objective C cannot run without FPU.
* SIGFPE in ldexp:: Some libm functions bomb.
File: djgppfaq.info, Node: Emulation, Next: Other emulators, Prev: Floating point, Up: Floating point
11.1 Floating code without 80387
================================
**Q*: I don't have an 80387. How do I compile and run floating point
programs?*
**Q*: What shall I install on a target machine which lacks hardware
floating-point support?*
*A* : Programs which use floating point computations and could be run on
machines without an 80387 should either be linked with the `libemu.a'
emulation library (add `-lemu' to your link command line) or be allowed to
dynamically load the `emu387.dxe' file at run-time if needed. Linking with
libemu makes distribution simpler at a price of adding about 20KB to the size
of the program `.exe' file (the emulator functions will be used only if no
hardware floating point support is detected at runtime). You should *always*
do one of the above when you distribute floating-point programs.
A few users reported that the emulation won't work for them unless they
explicitly tell DJGPP there is no x87 hardware, like this:
set 387=N
set emu387=c:/djgpp/bin/emu387.dxe
This is probably due to some subtle bug in the emulator setup code. This
code is hard to debug, because the people who developed it have machines with
hardware FP processors. Volunteers with FPU-less machines are needed to help
debug the above problem. If you have access to a system without an FPU and
are willing to fix this problem, write to Charles Sandmann
<sandmann@clio.rice.edu> and ask him for guidance.
There is an alternative FP emulator called `WMEMU' (get the file
`v2misc/wmemu2b.zip'). It mimics a real coprocessor more closely, but is
larger in size and is distributed under the GNU General Public License (which
generally means you need to distribute its source if you distribute
`wmemu387.dxe', or distribute the source or objects to your entire program,
if you link it with `libwmemu.a'). Its advantage is that with `WMEMU', you
can debug FP apps on a non-FPU machine. (But you will need to get the
sources and recompile it, since it was compiled with a beta release of DJGPP
and will cause unresolved externals if you try linking against `libwmemu.a'
without recompiling it.) Note, however, that even `WMEMU' doesn't solve all
the problems of debugging FP programs on a non-FPU machine (e.g., emulating
flags doesn't work).
File: djgppfaq.info, Node: Other emulators, Next: OS/2 emulation, Prev: Emulation, Up: Floating point
11.2 Other FP emulators cannot be used with DJGPP
=================================================
**Q*: I have an 80387 emulator installed in my `AUTOEXEC.BAT', but
DJGPP-compiled floating point programs still doesn't work. Why?*
*A* : DJGPP switches the CPU to *protected* mode, and the information needed
to emulate the 80387 is different. Not to mention that the exceptions never
get to the real-mode handler. You *must* use emulators which are designed
for DJGPP.
File: djgppfaq.info, Node: OS/2 emulation, Next: -msoft-float, Prev: Other emulators, Up: Floating point
11.3 Floating-point emulation under OS/2
========================================
**Q*: I run DJGPP in an OS/2 DOS box, and I'm told that OS/2 will install its
own emulator library if the CPU has no FPU, and will transparently execute
FPU instructions. So why won't DJGPP run floating-point code under OS/2 on
my machine?*
*A* : OS/2 installs an emulator for native OS/2 images, but does not provide
FPU emulation for DOS sessions.
File: djgppfaq.info, Node: -msoft-float, Next: Numeric exceptions, Prev: OS/2 emulation, Up: Floating point
11.4 DJGPP doesn't support `-msoft-float'
=========================================
**Q*: I've read in the GCC Info file that gcc has a `-msoft-float' option
which is said to generate library calls for floating point support. Can this
facility be used for FP emulation on a machine without x87?*
*A* : The GCC Info file also says that the library required by
`-msoft-float' is *not* part of the GNU C compiler. As nobody wrote such a
library for DJGPP (yet), this option currently isn't supported.
File: djgppfaq.info, Node: Numeric exceptions, Next: Emulator accuracy, Prev: -msoft-float, Up: Floating point
11.5 Numeric exceptions--sometimes
==================================
**Q*: I have a program which works with FP emulation, but dies with "Numeric
Exception" when run on a machine with a co-processor. It also runs OK when
compiled with Microsoft C. Can't you people make your floating-point code
right?*
*A* : This might be still a problem with your program. Under DJGPP, the
80x87 control word is set up so that it generates an exception when your
program feeds it with a "NaN" ("Not a Number"), while the emulator doesn't
have this behavior. You should make sure that your program doesn't generate
NaNs, or set the 80x87 control word to a different value. There is a program
called ctrl87.c, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/ctrl87.zip,
which enables this kind of diddling of the 80x87 control word; check it out.
There is also a library function called `_control87' which can be used from
within a program to set the coprocessor to a non-default state.
File: djgppfaq.info, Node: Emulator accuracy, Next: SIGFPE with ObjC, Prev: Numeric exceptions, Up: Floating point
11.6 Floating point inaccuracies when using emulator
====================================================
**Q*: I am experiencing inaccurate results in some floating point
calculations, sometimes in the 2nd or 3rd significant digit (like getting
118.401 instead of 120.0). This is really unacceptable! (And no, I'm *not*
using a buggy Pentium CPU.)*
*A* : Are you using the emulator? If so, it might be that the emulator
isn't as accurate as you expect. One particular known problem is that it
does a bad job when computing the `atan' function. So if you use `atan(1.)'
to get the value of `Pi', that might be your problem. Solution: make `Pi' a
constant, as God intended. The header file `<math.h>' includes the constant
`M_PI' which you can use; or get the value of Pi from the net, at this URL:
http://www.diku.dk/~terra/pi.html
File: djgppfaq.info, Node: SIGFPE with ObjC, Next: SIGFPE in ldexp, Prev: Emulator accuracy, Up: Floating point
11.7 Floating point exception in Objective-C programs
=====================================================
**Q*: When I run my Objective-C programs on a machine without an FPU, it dies
with a floating point exception, even though I installed the emulator as the
docs say...*
*A* : There is a bug in GCC 2.7.2 whereby it sometimes emits Objective-C code
that crashes ObjC programs. A patch that fixes it was posted to the DJGPP
news group and can be found in the DJGPP mail archives, at this URL:
http://www.delorie.com/djgpp/mail-archives/djgpp/1996/05/05/11:05:21
You will have to get the GCC source distribution `gcc272s.zip', install the
above patch, rebuild `cc1obj.exe', and then recompile `libobjc.a' to make the
problem go away.
File: djgppfaq.info, Node: SIGFPE in ldexp, Prev: SIGFPE with ObjC, Up: Floating point
11.8 Floating point exception in libm functions
===============================================
**Q*: When I use the `ldexp' function, my program crashes with SIGFPE.
What's wrong?*
*A* : There is a bug in the scaling code in `libm.a' library released with
DJGPP v2.0 which affects several library functions such as `ldexp'. A
work-around is to link without `-lm' switch; this will cause `GCC' to use
math functions from `libc.a'. If you need math functions which are only in
`libm.a', or if you need `libm.a' for better numerical performance, a patched
version of libm is available, e.g.
ftp://ftp.lstm.ruhr-uni-bochum.de/pub/djgpp/libm.zip, courtesy of Tom Demmer
<Demmer@LStM.Rurh-Uni-Bochum.De>. DJGPP v2.01 corrects this bug, so upgrade
to that version if and when it's available to you.
File: djgppfaq.info, Node: Debugging, Next: Profiling, Prev: Floating point, Up: Top
12. Debugging DJGPP Programs
****************************
This chapter discusses the debuggers you can use with DJGPP and answers some
of the questions you might have when debugging DJGPP programs.
* Menu:
* How to debug:: What should you do to debug a program.
* Old QDPMI:: Some QDPMI versions will crash the debugger.
* GDB needs COFF:: GDB can't use the .exe program.
* Transfer buffer:: Beware--debuggers use the transfer buffer.
* Debug graphics:: Debugging GUI programs.
* GDB and C++ source:: Problems with non-.cc extensions.
* C++ classes in GDB:: Class members' names in GDB.
* Included source:: Debuggers have problems with included files.
* Debugging woes:: Some programs which cannot be debugged.
File: djgppfaq.info, Node: How to debug, Next: Old QDPMI, Prev: Debugging, Up: Debugging
12.1 How to run a DJGPP program under debugger
==============================================
**Q*: How do I debug my programs?*
*A* : First, remember to use the `-g' switch when you compile and link.
This puts debugging information into your executable. When linking, don't
use the `-s' switch, and give the name of the output file *without the .exe
extension*, so that `gcc' will leave both the COFF output and the DOS
executable after the link stage. Here are a few examples of compilation and
link command lines when you intend to debug a program:
gcc -Wall -c -g -O myfile.c
gcc -Wall -O2 -g -o myprog mymain.c mysub1.c mysub2.c -lm
gcc -g -o myprog myprog.o mysub.o
(Note that with `gcc', you can use optimization switches when compiling with
`-g.')
Then, to debug the program, use a command line like this (here for `gdb'):
gdb myprog
You can use one of several available debuggers with DJGPP:
a. `FSDB', the full-screen debugger, from the `djdev' distribution. This
presents a user interface like that of Borland's Turbo Debugger, but
unlike TD, *it isn't a source-level debugger* (although it will show the
source code together with the machine instructions). It also supports
data-write breakpoints: a powerful feature for hunting down code which
overwrites data it shouldn't touch. Another advantage of `FSDB' is that
you can easily debug programs that grab the screen, because it can
switch between the debugger screen and the application screen. The main
disadvantage of `FSDB' is that you cannot easily examine the contents of
complex data structures. Remember to prepend an underscore `_' to the
names of C identifiers when you use them with `FSDB'; for C++ programs
you will have to find out the mangled names of static class variables
and methods to make `FSDB' understand them.
b. The GNU Debugger, `GDB' (get the file gdb412b.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/gdb412b.zip. This is
a powerful source-level debugger, but it uses a line-oriented user
interface. People who are familiar with using `GDB' on Unix should know
about the following important differences in its operation on MS-DOS:
* The command-line arguments can be only passed to the debuggee from
within the debugger (use the `set args' or `run' commands), not
from the `GDB' command line.
* You cannot rerun the debuggee when it exits. You must exit `GDB'
and restart it.
* `GDB' is currently configured for DJGPP in a way that makes loading
a program and reading a source file when a breakpoint is hit
*exceedingly* slow: it can take more than a minute for a very large
program. Be patient and don't decide that `GDB' is wedged unless
you've waited several minutes.
* `GDB' doesn't know about PC-specific keys, so you cannot use the
arrow keys for command history editing. Use ASCII control keys
instead (`^F' for forward character, `^B' for backward character,
`^P' for previous line, `^N' for next line, etc.).
* The debugger and the debuggee share their file handles. This means
that if your program redirects or closes its `stdin' or `stdout',
you will be unable to communicate with `GDB.'
* The initial commands are read from a file named `gdb.ini' instead
of `.gdbinit' which isn't a legal filename under MS-DOS.
* `GDB' uses the GNU `readline' package for its input. The
`readline' init file (`~/.inputrc' on Unix) is called `inputrc' on
MS-DOS and should be in the root directory of the current drive.
c. `EDEBUG32' is the most basic debugger you can use with DJGPP. One case
when you would need to use it is when you debug a DXE module (*note
explanation of what a DXE is: DXE.), because `GDB' doesn't support
debugging DXEs.
You invoke any debugger like this:
<debugger-name> <program> <args...>
Note that the `argv[0]' parameter under the debugger is *not* the full
pathname of the debuggee, so programs which use `argv[0]' for their operation
might behave differently under a debugger.
File: djgppfaq.info, Node: Old QDPMI, Next: GDB needs COFF, Prev: How to debug, Up: Debugging
12.2 You need QEMM 7.53 or later
================================
**Q*: Whenever I call any DJGPP debugger to debug my program, it crashes
immediately.*
*A* : Are you running under Quarterdeck's QDPMI? Then you should upgrade to
QEMM 7.5 patch-level #3 or later. That patch corrects a subtle problem in
QDPMI which was triggered by the debugger. If you cannot or wouldn't
upgrade, for money or love, turn OFF the DPMI services of QDPMI and use
`CWSDPMI' as your DPMI host. To disable QEMM DPMI services either uninstall
QDPMI, or go to the QEMM directory and issue the following command:
qdpmi off
File: djgppfaq.info, Node: GDB needs COFF, Next: Transfer buffer, Prev: Old QDPMI, Up: Debugging
12.3 GDB won't debug unless it sees COFF output
===============================================
**Q*: I try invoking GDB on my program, but it says: "not in executable
format: File format not recognized." Huh?*
*A* : Most probably, you've invoked GDB on a `.exe' program. GDB needs to
be called with the name of un-stubbed COFF executable as its argument. To
get both a `.exe' and a COFF file, you should make your link command line
look this way:
gcc -o foo foo.o
instead of
gcc -o foo.exe foo.o
(the latter will only produce `foo.exe', while the former produces both
`foo', the COFF executable which gdb needs, and `foo.exe').
To produce a COFF file from a `.exe' program, use the `EXE2COFF' program
which comes with DJGPP, like this:
exe2coff foo.exe
File: djgppfaq.info, Node: Transfer buffer, Next: Debug graphics, Prev: GDB needs COFF, Up: Debugging
12.4 Debuggers use the transfer buffer.
=======================================
**Q*: My program corrupts files and screen writes, and otherwise behaves
strangely when run under a debugger.*
*A* : Do you use the transfer buffer to move data between your program and
conventional (under 1 MByte) memory? Then it might be that the debugger
corrupts your I/O. The debugger itself uses the transfer buffer for disk read
requests and screen writes. If you single step through any of your app
routines which use the transfer buffer, the debugger might overwrite its
contents, which may alter the correct behavior.
To work around this, don't step with the debugger through your functions
which use the transfer buffer.
If all of the above doesn't make sense for you, don't worry: if you don't
know what the transfer buffer is, and you only trace into your own functions,
then you won't hit this problem.
File: djgppfaq.info, Node: Debug graphics, Next: GDB and C++ source, Prev: Transfer buffer, Up: Debugging
12.5 How to debug a graphics program
====================================
**Q*: How can I debug a graphics program? The debugger runs my program fine,
but when a breakpoint is hit with the screen in a graphics mode I can't read
the text printed by the debugger.*
*A* : Redirect the debugger output to your printer, like this:
gdb myprog > prn
This will only work if the program itself doesn't write to stdout (this is
usually the case with graphics programs); otherwise the debugger output will
get mixed up with your program's output.
The FSDB debugger can switch between the application screen and the debugger
screen, so you might use it, at a price of working with a low-level debugger.
Press `Alt-F5' to switch between the two screens. Stock FSDB as distributed
with DJGPP can only do this with text screens, but a modified version of FSDB
with graphics support, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/gnudebug.zip is available that knows
about many graphics modes (it can also be found on the Oulu repository, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/gnudebug.zip).
As yet another possibility, consider using the `MSHELL' program which will
redirect I/O from any program to the monochrome monitor at the BIOS level, so
you can use it even with GDB. `MSHELL' was written by DJ Delorie
<dj@delorie.com> and is available as mshell10.zip, e.g.
ftp://ftp.delorie.com/pub/djgpp/ofc/mshell10.zip. Be sure that you don't
have some other TSR installed that catches screen writes and bypasses the
BIOS functions, or else `MSHELL' won't help you. For example, changing the
code page (with the DOS `CHCP' or `MODE' commands) might do this.
File: djgppfaq.info, Node: GDB and C++ source, Next: C++ classes in GDB, Prev: Debug graphics, Up: Debugging
12.6 GDB finds only `.cc' source
================================
**Q*: When I try to debug my C++ programs, the debugger claims it can't find
the source file:*
file.cc: No such file or directory.
*The source file *is* there, but it's called `file.cpp', not `file.cc.' Why
does this happen?*
*A* : It's a bug in GCC. It erroneously assumes that a C++ source always
has a `.cc' extension. Until this bug is corrected in some future version of
GCC, you're better off calling your C++ files `*.cc.' If this is
unacceptable, then you can work around this bug by invoking `cc1plus' and the
assembler pass manually. The bug in GCC manifests itself in that `cc1plus'
is called with the option `-dumpbase file.cc.' If you replace this with
`-dumpbase file.cpp' (or whatever your extension is), the debugger will
happily find your sources.
File: djgppfaq.info, Node: C++ classes in GDB, Next: Included source, Prev: GDB and C++ source, Up: Debugging
12.7 Can GDB print class members?
=================================
**Q*: It seems that GDB doesn't recognize C++ class members by their
original, unmangled names. Do I really need to figure out the mangled names
of all my class variables and methods to be able to debug them?*
*A* : No, you don't. `GDB' *does* allow you to use the original names, it's
just that it usually treats the `::' in their names as word delimiters.
Include the name of the method or a class static variable in single quotes,
and `GDB' will recognize them as a single word. For example, if your class
`CMPForward' has a method named `go' which you need to put a breakpoint in,
use the following command:
b 'CMPForward::go'
Other `GDB' features that might be useful in this context are the various
demangling options, like `set print demangle', `set demangle-style' etc.;
look them up in the GDB on-line docs.
File: djgppfaq.info, Node: Included source, Next: Debugging woes, Prev: C++ classes in GDB, Up: Debugging
12.8 GDB cannot list source that was #include'd
===============================================
**Q*: My source file #include's another source file, but I cannot set a
breakpoint in that included code, because GDB says there is no such line, or
no such source file...*
**Q*: I cannot debug code produced by Flex, or Bison, or F2C, because GDB
somehow messes up all the source file and line number info!*
*A* : This is a genuine limitation of the COFF format used by DJGPP. It can
only handle a single source file for a given object file. It does include
correct line numbers, but the name of the source file is wrong, so debugging
such files just doesn't work.
For source files that include other source files, you can work around this by
just inserting the included source with your editor while you debug the
program. For code produced by other programs, like `F2C' or `Bison', you
will have to delete the `#line' directives from the generated C source, and
debug the generated code as regular C program.
File: djgppfaq.info, Node: Debugging woes, Prev: Included source, Up: Debugging
12.9 Debuggers choke on some programs ...
=========================================
**Q*: I cannot debug Emacs (or any program that requests raw keyboard input):
when I press Ctrl-C, any debugger I tried reported SIGINT. But I cannot
operate the debugged program without Ctrl-C (in Emacs, it's necessary to exit
the editor)!*
**Q*: I cannot debug any program which catches signals!!??*
**Q*: I compiled my program with `-pg' switch, and now I cannot debug it...*
**Q*: When my program hits a breakpoint in GDB, the debugger reports SIGSEGV,
but only under Windows...*
*A* : There are currently a few limitations in debugging programs which use
interrupts or exceptions. Programs compiled for profiling may crash with
SIGSEGV or a GPF, with no addresses that `symify' can identify; programs
using `alarm' or `setitimer' can't be debugged, either. You can't hook the
keyboard interrupt in a debugged program, and you can't debug a program which
uses floating point on a machine without FP hardware (unless you use `WMEMU'
as your emulator, but even WMEMU doesn't solve all the problems). The reason
for all these problems is that any exceptions or signals that happen when
your program runs under a debugger will be caught by the debugger instead,
and they won't get passed to the debuggee. To debug programs which hook
hardware interrupts, you will have to chain the old real-mode interrupt
handler to your new handler, which requires to write special debug version of
the program.
At least some of these limitations will be fixed in future versions of DJGPP.
For now, the only work-around that's available is for the case where you
need a `Ctrl-C' keypress to go to the debuggee instead of the debugger: use
the `Alt-Numeric-3' (that is, simultaneously press the `Alt' key and the `3'
key on the numeric keypad, then release the `Alt' key).
Several users reported that `GDB' GP Faults when the program hits a
breakpoint under Windows. The only work-around is to use `FSDB' which works
in that environment.
File: djgppfaq.info, Node: Profiling, Next: Performance, Prev: Debugging, Up: Top
13. Profiling DJGPP Programs
****************************
This chapter explains how to optimize your program for speed using the
profiler, and discusses some problems you might have with it.
* Menu:
* How to profile:: What should you do to profile a program.
* Gprof needs COFF:: Gprof doesn't like .exe executable.
* Gprof docs:: Look on Gprof man page for its docs.
* I/O bound programs:: How their profiles look.
* No profile:: Where is the profile?
File: djgppfaq.info, Node: How to profile, Next: Gprof needs COFF, Prev: Profiling, Up: Profiling
13.1 How to profile a DJGPP program
===================================
**Q*: How can I profile my program to see where it spends most of its run
time?*
*A* : DJGPP includes a profiling facility. To use it, compile and link with
`-pg' option, run your program as you usually would, then run a program
called `gprof':
gprof myprog
(change `myprog' to whatever name your program is). This will print an
execution profile.
`Gprof' is part of GNU Binutils distribution, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu252b.zip.
File: djgppfaq.info, Node: Gprof needs COFF, Next: Gprof docs, Prev: How to profile, Up: Profiling
13.2 Gprof won't work unless it can find COFF executable
========================================================
**Q*: When I run `Gprof', it complains that it cannot find my program. But
I've just run it!!*
**Q*: I run `Gprof' on my program, and it says: "bad format".*
*A* : `Gprof' needs the original COFF file the linker produced. If you
delete it, or feed `Gprof' with the `.exe' file instead, it will be most
unhappy. The way to produce the COFF output is explained in the *Note
section dealing with GDB: GDB needs COFF, above.
File: djgppfaq.info, Node: Gprof docs, Next: I/O bound programs, Prev: Gprof needs COFF, Up: Profiling
13.3 Where is Gprof docs?
=========================
**Q*: What about all those `Gprof' options? Where can I find their docs?*
**Q*: I can't figure out some of the info in the `Gprof' report ...*
*A* : `Gprof' is only documented on a man page, `gprof.1.' If you don't
have one, you will have to look for it in the Binutils distribution, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu252b.zip.
File: djgppfaq.info, Node: I/O bound programs, Next: No profile, Prev: Gprof docs, Up: Profiling
13.4 Why is `__dpmi_int' so heavy used?
=======================================
**Q*: I've profiled my program and found that the routine which takes 60% of
the running time is some obscure library function called `__dpmi_int.' Can't
you guys make your library right?*
*A* : Does your program use I/O or other real-mode services (like BIOS)
extensively? All those services are invoked through a DPMI service call
which is issued by `__dpmi_int.' So what the profile really says is that the
running time of your program is governed by time-consuming operations such as
disk I/O.
File: djgppfaq.info, Node: No profile, Prev: I/O bound programs, Up: Profiling
13.5 `gprof' doesn't produce output
===================================
**Q*: Every time I run the profiler it says "gmon.out: no such file or
directory" and no profile is produced. What is this `gmon.out' and why won't
`gprof' compute the profile?*
*A* : `gmon.out' is the file with raw execution counts and timing info that
`gprof' needs to produce the profile. The file is written by the profiled
program when it exits. If the file isn't created, it might be because one of
the following reasons:
* You didn't compile and/or link your program with the `-pg' switch. Note
that *both* compilation and link need to be done with `-pg', because the
functions that actually write the results to `gmon.out' are only linked
in when `gcc' sees `-pg' on the link command line.
* You have called `ld.exe' directly to link your program and forgot to
mention the files and switches necessary for the profiled program
operation. You should use `gcc' to link your program instead of calling
the linker directly; a `-pg' switch to `gcc' is all that it takes to
make sure that the linker will get all the necessary arguments. (1)
(*note No profile-Footnotes::)
* Your program exited abnormally. The function which generates `gmon.out'
is registered with the `atexit' library function, which won't be called
if the program was terminated in an abnormal way. Make sure that your
program exits with a call to `exit' or with a `return' statement in your
`main' function. For example, if your program dies with an exception or
a signal, install a signal handler and make it call `exit.'
File: djgppfaq.info, Node: No profile-Footnotes, Up: No profile
(1) If you absolutely need to call `ld.exe' directly, invoke `gcc' once with
a `-v' switch and you will see what the arguments are that you should pass to
the linker in your case.
File: djgppfaq.info, Node: Performance, Next: Memory, Prev: Profiling, Up: Top
14. Run-time Performance of DJGPP Programs
******************************************
This chapter deals with issues pertinent to run-time performance of DJGPP
programs.
* Menu:
* How fast:: What code quality should you expect.
* Faster v1:: Is v1.x faster than v2?
* Pentium:: Is v2 slower on a Pentium?
* I/O speed:: Is I/O *really* so slow in protected mode?
* Slow-down:: What if your ported program runs slower?
File: djgppfaq.info, Node: How fast, Next: Faster v1, Prev: Performance, Up: Performance
14.1 How efficient is DJGPP-generated code?
===========================================
**Q*: How does DJGPP compare with other DOS-based C compilers in terms of
efficiency of generated code?*
**Q*: Won't my program run *much* slower when compiled by DJGPP, due to all
those CPU cycles wasted in switches between protected and real mode?*
*A* : The quality of code generated by GCC with optimization turned on
(`-O2' switch to the compiler) is generally at least as good as what you will
get from top commercial products, like Borland, Microsoft and Watcom. Mode
switches indeed have a certain performance hit, but in most programs it is
negligibly small, because only DOS and BIOS services require such a switch,
and most programs spend most of their time doing other things.
File: djgppfaq.info, Node: Faster v1, Next: Pentium, Prev: How fast, Up: Performance
14.2 Comparing v2 with DJGPP v1.x
=================================
**Q*: I switched to v2 and my programs now run slower than when compiled with
v1.x...*
*A* : In general, GCC 2.7.2 which comes with DJGPP v2.0 generates tighter,
faster code. But it sometimes produces buggy code when "strength reduction"
optimizations are enabled. So DJGPP by default disables this kind of
optimization, which might sometimes yield slower code. If you need extra
speed, first debug your program with default optimization options, and then
recompile with `-fstrength-reduce' switch to see if that makes any difference.
GCC has a plethora of other optimization options which might make your code
faster; the best way to know is to profile and experiment.
File: djgppfaq.info, Node: Pentium, Next: I/O speed, Prev: Faster v1, Up: Performance
14.3 Comparing v2 code on i486 vs Pentium
=========================================
**Q*: I run the same program on a 486 and on a Pentium, and it's slower on a
Pentium!!*
*A* : This might be due to alignment problems in DJGPP. GCC makes
assumptions about how GAS (the assembler) handles alignment, but when GAS is
built with the default DJGPP configuration, it treats alignment in a way
that's different from what GCC assumes. The outcome of this is that longs
are word-aligned, doubles are dword-aligned, etc. Depending on the DJGPP
version, link order, library differences, you might get lucky (or unlucky)
with a 50/50 chance to get an improper alignment. Different CPUs have
different penalties for unaligned accesses, which may explain what you see.
You might consider adding some slack static variables to induce changes in
alignment; if any of the changes suddenly cause a significant change in the
runtime performance, then alignment might be the reason.
File: djgppfaq.info, Node: I/O speed, Next: Slow-down, Prev: Pentium, Up: Performance
14.4 My program's I/O is so slow!
=================================
**Q*: I measured the time required to read a 2 MByte file in DJGPP and in
Borland C. It took the DJGPP program 2.5 seconds to do it, while Borland did
it in just under 2. Isn't that *horribly* slow performance??*
**Q*: I tried to improve DJGPP I/O throughput by defining a 64KB-large buffer
for buffered I/O with a call to `setvbuf', but that had no effect. Why is
that?*
*A* : Doing I/O from protected-mode programs requires that low-level library
functions move the data between the extended memory and low memory under the
1 MByte mark, where real-mode DOS can get at it. This area in the low memory
is called the "transfer buffer". This data shuffling means that some I/O
speed degradation is inevitable in any protected-mode program which runs
under DOS. By default, DJGPP moves data in chunks of 16 KB, so defining a
buffer larger than that won't gain anything. The size of transfer buffer is
customizable up to a maximum of 64 KB, so if your program really reads a lot
of large files, you might be better off enlarging it (with the `STUBEDIT'
program).
That said, I would like to point out that waiting another 0.5sec for reading
a 2 MByte file isn't that bad: it is indeed about 25% longer than you can do
under DOS, but it's only half a second... Besides, most programs read and
write files which are only a few hundreds of kilobytes, and those will suffer
only a negligible slow-down.
File: djgppfaq.info, Node: Slow-down, Prev: I/O speed, Up: Performance
14.5 My ported program runs much slower!
========================================
**Q*: How come my program, which I ported from Borland/MS C and which doesn't
use much I/O, still runs much slower under DJGPP? *
*A* : Explore the following possible causes for this:
a. Your program extensively calls services other than I/O which require mode
switch (like BIOS Int 10h, mouse services, etc.).
You can tell how much your program switches to real mode by profiling
your program. In the profile, look at the proportion of time your
program spends in low-level library functions called `__dpmi_int' (which
calls real-mode DOS/BIOS services) and `__dj_movedata' (which moves data
between the transfer buffer and your program). If this proportion is
large, try rewriting your program to minimize use of those functions
which require a mode switch, even at a price of more computation (a mode
switch usually eats up hundreds of CPU cycles).
b. Your program uses library functions/classes which are implemented less
efficiently by GCC. Or you might be a heavy user of functions which
other compilers convert to inline code, while GCC doesn't inline most
library functions. If this is the case, you will see those functions as
"hot spots" on the program histogram produced by the `Gprof' profiler.
If you find this to be the problem, write your own, optimized versions of
those functions. It's best to write them as inline assembly functions,
for maximum performance. If you find library functions which are
inefficient, please inform the DJGPP news group by posting to the
comp.os.msdos.djgpp news group, so this could be fixed by people who
maintain the library.
c. If your program spends most of its time in a certain innermost loop, you
might try enabling the strength-reduction optimizations. This is
disabled by default, because GCC has a known bug which sometimes causes
it to generate incorrect code when this kind of optimization is enabled.
If you decide to enable it, examine the behavior and the output of your
program carefully, to be sure you didn't hit that bug.
File: djgppfaq.info, Node: Memory, Next: Command line, Prev: Performance, Up: Top
15. Run-Time Memory Issues
**************************
This chapter answers questions which are related to DJGPP run-time memory
allocation.
* Menu:
* How much memory:: How much can you use?
* Confusing alloc:: Allocation mechanism peculiarities.
* QDPMI VM:: QDPMI doesn't provide virtual memory.
* QDPMI alloc:: QDPMI/Win 95 memory allocation peculiarities.
* Windows alloc:: VM issues under Windows 3.x.
* Win9x alloc:: VM peculiarities under Win9x.
* EMM386 alloc:: Some versions of EMM386 are limited to 32 MBytes.
* Swap out:: How much VM do spawned program have?
* Stack size:: How large is the stack and how to enlarge it?
File: djgppfaq.info, Node: How much memory, Next: Confusing alloc, Prev: Memory, Up: Memory
15.1 How much virtual memory do you have?
=========================================
**Q*: How much virtual memory can I use in DJGPP programs?*
*A* : That depends on the DPMI host you are using. CWSDPMI (the free DPMI
host which comes with DJGPP) will let you use all available conventional and
extended memory (up to 128M) and up to 128M of disk space, for a grand total
of 256M of virtual memory for your application. Try a `malloc(50*1024*1024)'
some day.
With other DPMI hosts, your mileage may vary. Quarterdeck's QDPMI, for
instance, has a bug in some of its versions which effectively disables
virtual memory under DJGPP (described under *Note QDPMI VM bug: QDPMI VM,
below), so you only have whatever free physical RAM is left. Under Windows
3.x, the amount of virtual memory you get depends on various virtual memory
settings in the Control Panel and on the `.pif' file settings for the program
you run (see *Note Windows allocation subtleties: Windows alloc, below).
Under Windows 9x, the memory settings of the DOS Applications' Property Sheet
define how much virtual memory a DJGPP program will get (see *Note Win9x
allocation details: Win9x alloc, below).
File: djgppfaq.info, Node: Confusing alloc, Next: QDPMI VM, Prev: How much memory, Up: Memory
15.2 It seems `malloc'/`free' don't affect virtual memory...
============================================================
**Q*: I did `malloc(50*1024*1024)', but didn't see any paging happen, and I
only have 8 MBytes of RAM on my machine. Is this virtual memory thing for
real?*
**Q*: I `malloc''ed a large chunk of memory, but when I check values returned
by `_go32_remaining_physical_memory' or `__dpmi_get_memory_information', I
don't see any change...*
**Q*: When I `free' allocated RAM, `_go32_remaining_physical_memory' reports
there was no change in the available RAM.*
*A* : CWSDPMI (and, possibly, other DPMI hosts) only pages in memory when it
is actually accessed. If you only `malloc' it, but don't actually access it,
it won't grab those pages. Try `calloc' and see the *big* difference.
When you call `free', DJGPP library doesn't return memory to the system, it
just adds it to its internal pool of free pages. So, from the system point
of view, these pages are not "free".
File: djgppfaq.info, Node: QDPMI VM, Next: QDPMI alloc, Prev: Confusing alloc, Up: Memory
15.3 Failure to get more memory than is physically installed
============================================================
**Q*: When I try to access more memory than the free physical RAM, `malloc'
returns a `NULL' pointer, or I get some cryptic error message like this:*
DPMI: Not enough memory (0x00860000 bytes)
*or like this:*
QDPMI: Memory Paging Violation: Illegal Page Reference [PTE=0000-0000h]
[CR2=8006-3000h at 00E7h:0000-4936h]
QDPMI: Unrecoverable Exception: 000Eh at 00E7h:0000-4936h. Error Code = 0006h
*A* : This is typical of Quarterdeck's DPMI host called QDPMI which comes
with QEMM386 version 7.53 and earlier. Some versions of QDPMI (those which
come with QEMM v6.x) fail to resize memory blocks when the new size is more
than the available physical RAM, even though virtual memory services are
enabled; other versions (those which come with QEMM v7.x) just don't let you
allocate more memory than is physically available. If you must use more RAM
than is physically available, *Note disable or uninstall QDPMI: Old QDPMI,
and use CWSDPMI instead.
This bug was corrected in QDPMI version 1.10 or later, distributed with QEMM
beginning with version 8.0, so upgrading to the latest version of QEMM might
also be a solution. With QEMM 6.x, make sure your programs don't override
the default type of `sbrk' behavior by setting `_crt0_startup_flags' to
`_CRT0_FLAG_UNIX_SBRK' (QEMM 8.0 and later can allocate virtual memory with
both types of `sbrk' algorithm).
If you use another DPMI host, make sure that virtual memory is enabled.
E.g., for 386Max, include the `swapfile=' parameter to establish a virtual
memory swap file; you can make it permanent (this will speed up DJGPP
start-up) with the `/p' option.
File: djgppfaq.info, Node: QDPMI alloc, Next: Windows alloc, Prev: QDPMI VM, Up: Memory
15.4 Memory allocation fails before all memory is used
======================================================
**Q*: OK, I've changed my program to never allocate more memory than is
physically available, to work around that *Note QDPMI VM bug: QDPMI VM, but
my program still gets a `NULL' pointer from `malloc/calloc'!*
**Q*: Why is my program dying with SIGSEGV under CWSDPMI when allocating a
chunk of memory?*
*A* : Another peculiarity of QDPMI which came with QEMM before version 8.0:
it will never let you allocate a chunk which is larger than half of what's
available. The Windows 3.x behaves in the same way, and several people
reported the same to be true under Windows 95.
With some DPMI providers, this behavior might be triggered by a small
overhead of each `malloc' call: you might ask for half of available memory,
but the DJGPP implementation of `malloc' adds the overhead and then rounds
the amount of memory to the next power of 2 before calling `sbrk'; thus
`malloc(8MB + 1)' will actually request 16MBytes from the DPMI host. When in
doubt, call `sbrk' directly, especially if you don't plan to free that memory
during execution.
If your program asks for memory in lots of small allocations, then it might
crash when you use CWSDPMI as your DPMI host. This is because CWSDPMI runs
out of its memory where it tracks memory allocations. If you use release 1
of CWSDPMI, you can enlarge the maximum space that CWSDPMI uses if you get a
CWSDPMI heap-fix patch, e.g.
ftp://ftp.neosoft.com/pub/users/s/sandmann/csdpmi1heapfix.zip. Beginning
with release 2, CWSDPMI defines a larger (6KB) default heap that is
configurable by CWSPARAM program to be anywhere between 3K and 40K bytes,
without recompiling CWSDPMI. You should upgrade to the latest CWSDPMI if you
experience such problems.
File: djgppfaq.info, Node: Windows alloc, Next: Win9x alloc, Prev: QDPMI alloc, Up: Memory
15.5 Memory allocation fails under Windows
==========================================
**Q*: I'm running under Windows 3.x DOS box, but DJGPP complains about there
not being enough DPMI memory, although virtual memory is enabled.*
*A* : You must make sure the size of your Windows swap file can be at least
2 times the largest virtual memory size you need. Check if you have enough
free disk space; if you do, run a defragger (Windows needs the swap file to
be contiguous). This size is normally limited by the the "virtual = 4 times
free physical" rule, but you can change that by inserting the line
PageOverCommit=n
in the `[386Enh]' section of your `SYSTEM.INI' file. The parameter `n' is 4
by default, but can be set to be as large as 20.
File: djgppfaq.info, Node: Win9x alloc, Next: EMM386 alloc, Prev: Windows alloc, Up: Memory
15.6 Memory allocation peculiarities under Windows 9x
=====================================================
**Q*: I seem to be unable to get more than 16 MBytes of virtual memory under
Windows 95, even though I have 32 MBytes of RAM installed on my machine, and
a lot of disk space...*
*A* : You must set the maximum amount of DPMI memory to 65535K in the DOS
applications' property sheet. If you leave that setting at the default
"Auto", you only get 16 MBytes. You must actually type 65535 inside the
dialog box, as checking out the values from the list Windows offers will
never get you past 16384 (i.e., 16MB).
Note that you cannot allocate more than half the available memory in one
chunk under Windows 9x, exactly as the things are under Win3.x.
File: djgppfaq.info, Node: EMM386 alloc, Next: Swap out, Prev: Win9x alloc, Up: Memory
15.7 Memory allocation fails under EMM386 or HIMEM
==================================================
**Q*: My machine has 48 MBytes of RAM, but when I run DJGPP programs, they
start paging after 32 MBytes have been used...*
**Q*: I have 5 MBytes of free RAM on my machine, but DJGPP programs start
paging after only 256KBytes of memory were used??*
*A* : This might be caused by some old versions of the memory manager
installed in your machine (like HIMEM or EMM386 from an old version of DOS),
which were limited to 32 MBytes of expanded memory. Try running without them
(CWSDPMI can use raw extended memory), or upgrade to a newer version of DOS.
If your programs start paging after only 256KBytes of memory were used, most
probably you are using EMM386 and CWSDPMI, and your `CONFIG.SYS' specifies no
amount of memory when it installs EMM386. EMM386 defaults to 256K in this
case; you should tell EMM386 explicitly how much memory it should take over.
You can use the `go32-v2' program to see what amount of extended memory your
DJGPP programs will get.
File: djgppfaq.info, Node: Swap out, Next: Stack size, Prev: EMM386 alloc, Up: Memory
15.8 How much memory do parent DJGPP programs leave for their child?
====================================================================
**Q*: How much memory is available when I call the `system' library function?*
*A* : In the conventional (below 640K mark) memory, you are left with
everything which was free before your program started, except what the DPMI
host uses. The amount of conventional memory required by the DPMI host
depends heavily on the host you use. For the first DJGPP program, QDPMI uses
about 97K, CWSDPMI uses about 70K, Windows 3.x only 18 KBytes. Each
subsidiary call to `system' (like in recursive invocation of `Make') eats up
about 18K (16K for the transfer buffer and 2K for the PSP and environment)
for most DPMI servers; a notable exception is QDPMI which needs 97K bytes of
low memory for the subsequent calls too. If you change the size of the
transfer buffer (with `STUBEDIT'), the amount of free conventional RAM will
change accordingly.
Extended memory management is left to the DPMI server; DJGPP does nothing
special about XMS when `system' is called. This means that all the extended
memory used by the parent program is *not* freed when the child program
starts; if the child requests more memory than is physically free, the DPMI
server is expected to page some of the parent out to honor the request.
(This is unlike DJGPP v1.x, where the `go32' extender would completely page
out the parent before starting the child.) The advantage of this is that
spawning a child or shelling out is much faster in v2.0 than it used to be
with v1.x, except on machines with low amounts of installed RAM. A
disadvantage is that if you spawn a real-mode program that uses XMS, the
extended memory used up by your DJGPP program will be unavailable to it,
unless you use a memory manager (as opposed to when CWSDPMI uses raw XMS or
HIMEM). The only way around this problem is to buy more RAM, or to install a
real memory manager.
File: djgppfaq.info, Node: Stack size, Prev: Swap out, Up: Memory
15.9 How much stack can I have in DJGPP programs?
=================================================
**Q*: My program bombs when I use very large automatic arrays.*
**Q*: How much stack space do I have in my program?*
**Q*: My program seems to overflow the stack, but only when I run it under a
debugger...*
**Q*: My program crashes with SIGSEGV, but the traceback makes no sense: it
points to something called ___djgpp_exception_table... When I try to debug
this, the traceback mysteriously changes to some innocent library function,
like getc(). The same program works flawlessly when compiled with DJGPP v1.x
What's going on??*
*A* : DJGPP v2.0 programs impose a limit on the maximum stack size; this is a
bug/feature of the DPMI 0.9 specification. By default, you have a 256KB-long
stack, but some programs which use large automatic arrays, or are deeply
recursive, might need more. If the default stack size is not enough, you can
change it with the `STUBEDIT' program (change the parameter "Minimum amount
of stack space"), or by setting the global variable `_stklen' in your
program. Example:
unsigned _stklen = 1048576; /* need a 1MB stack */
The DJGPP startup code checks both these values and uses the largest of the
two. Therefore, programs that are known to require large stack size should
set `_stklen' to make sure they will always work, even if somebody stub-edits
them to a lower value. This technique is also safer when you need to debug
your program with `gdb' (see below). However, you might need to use
`STUBEDIT' with programs for which you don't have the sources.
Programs which needs an unusually large stack might crash with bogus stack
traces, because part of the heap gets overwritten by the overflowing stack.
To see if that is the cause of such crashes, run `STUBEDIT' on your program
and crank up the stack size to a large value (like 4MBytes). If that makes
the problem go away, tune the stack limit to the minimum value your program
can live with, then set `_stklen' to an appropriate value as explained above
and recompile the program. (Some DPMI hosts will actually allocate the
entire stack, even if not all of it is used, so leaving it at unnecessarily
large value will hurt the program on low-memory machines.)
Some users have reported that they needed to enlarge the stack size of the
C++ compiler, `cc1plus.exe', to prevent it from crashing when compiling some
exceedingly large and complex C++ programs. Another program that was
reported to need a stack larger than the default is `bccbgi.exe' from the
`BCC2GRX' package.
After you've used `STUBEDIT' to change the stack size, run it again to make
sure it displays as default the value you thought you entered. This is
because `STUBEDIT' will sometimes silently set the stack size to 0 (and then
you will get the default 256K stack) if it doesn't like the value you type.
When you run a program as an un-stubbed COFF image under a debugger, the
stack size comes from the debugger. So if your program needs a large stack
and you run it under `gdb' (which always requires a COFF image of the
debuggee), be sure to stubedit `gdb' to enlarge its stack to at least the
value your program needs to run safely.
Under Windows, be sure you've allocated a sufficiently large swap file (let's
say, 40MBytes) from the Windows' Control Panel, and make sure the `.PIF' file
for your program doesn't have too low limit on EMS/XMS usage (better make
them both -1). What's that? You don't have a `.PIF' file for this program?
Then Windows uses the default file `DOSPRMPT.PIF', which almost surely
defines very low limits on these two, and your program might have problems
getting the memory it needs for its stack.
DJGPP v2.0 has a subtle bug in its startup code that is seen very rarely, and
that manifests itself by a program crashing with Page Fault or SIGSEGV. If
enlarging the stack and the CWSDPMI heap size didn't help, try adding some
(e.g., 4KB) static data to your program and see if that helps.
File: djgppfaq.info, Node: Command line, Next: Converting, Prev: Memory, Up: Top
16. Command-line Arguments Handling in DJGPP
********************************************
DJGPP handles command-line arguments differently from most DOS-based
compilers, to make it closer to Unix platforms (so that porting of Unix
programs will be easier). This chapter answers some questions about this
aspect of DJGPP.
* Menu:
* Filename globbing:: Wildcard expansion under DJGPP
* Disable globbing:: You can disable globbing if you don't need it.
* Special chars:: How to pass arguments with special chars.
* Long commands:: DJGPP can pass very long command lines.
* How long:: Look here to find out how long.
* Makefiles:: Makefiles can disable long command lines.
File: djgppfaq.info, Node: Filename globbing, Next: Disable globbing, Prev: Command line, Up: Command line
16.1 Filename wildcards expansion under DJGPP
=============================================
**Q*: Can I do filename globbing with DJGPP?*
**Q*: I call my program with an argument `x*y' and it complains about
something called `xyzzy'??...*
*A* : The filename globbing in DJGPP is done by the start-up code, before
your `main' function is called. Unlike other DOS-based compilers, where you
must link your program with a special object module if you want the program
to get expanded filenames, in DJGPP this is considered normal behavior and
performed by default on behalf of every DJGPP program. The `x*y' above was
expanded to a file called `xyzzy' which was probably present in the current
working directory. (If you don't want the default expansion, see *Note how
to disable globbing: Disable globbing.)
In DJGPP, filename globbing works like in Unix, which is more general than
the usual DOS wildcard expansion. It understands the following constructs
with special meta-characters:
any single character.
zero or more arbitrary characters, including a dot `.'
`[aA_]'
any one of characters `a', `A', or `_'.
`[a-d]'
any one of characters `a', `b', `c', or `d'.
`[!a-z]'
anything *but* a lowercase letter.
`...'
all the subdirectories, recursively (VMS aficionados, rejoice!).
`.../*'
all the files in all subdirectories, recursively.
Unlike DOS, the `*' and `?' meta-characters can appear *anywhere* in the
filename pattern, like in `[a-z]*[0-9].*pp.' You can also use `*' instead of
directories, like in `*/*/*.c', but *not* on drive letters (e.g., `[a-c]:/'
won't work).
Note that `*.*' only picks up files that actually have an extension. This is
contrary to the usual DOS practice where it means *all* the files, with or
without extension.
An argument which cannot be expanded (no filenames matching that particular
pattern) will be passed to the program verbatim. This is different from what
you might see under Unix, where some shells (like `csh') would say something
like "No match" and won't call your program at all. DJGPP's behavior in this
case is like shells of the Bourne legacy (`sh', `ksh', and `bash').
File: djgppfaq.info, Node: Disable globbing, Next: Special chars, Prev: Filename globbing, Up: Command line
16.2 How to disable filename wildcards expansion
================================================
**Q*: OK, but I don't want my program to glob its arguments (they aren't
files at all, but they include characters like `*' and `?'). What should I
*A* : You have these alternatives:
* Surround your arguments with single or double quotes (this is what you
would do under a Unix shell).
* Disable globbing for your program by linking it with your custom version
of the function with the special name `__crt0_glob_function' and make it
always return a `NULL' pointer. See the documentation of this function
in the library reference.
File: djgppfaq.info, Node: Special chars, Next: Long commands, Prev: Disable globbing, Up: Command line
16.3 How to pass command-line arguments with quotes or <@>
==========================================================
**Q*: I have a file with a single quote in its name, but the quote seems to
be stripped away when I pass it to my program ...*
**Q*: How do I pass a command-line argument which contains double quotes? *
**Q*: How do I pass an argument which begins with the <@> character?*
*A* : These special characters on the command-line arguments are handled by
the filename expansion ("globbing") code before they are passed to the `main'
function (*note description of filename expansion: Filename globbing.), and
the quote characters serve to protect the arguments from expansion. You
should escape-protect the quote characters with a backslash in order for them
to be treated as literal characters. For example, if you have a file called
`myfile.c'v', type it as `myfile.c\'v' when you call your program. If you
have single quotes in your program arguments *and* you don't want those
arguments to be expanded, then surround them by double quotes, like this:
`"*.c\'v".' The program will get the string `*.c'v' with the double quotes
stripped away.
Note that backslashes are only special if they are in front of a quote,
whitespace, or backslash (they also serve as DOS directory separators,
remember?).
The <@> character serves to signal a "response file" (*note the description
of response file method: Long commands.), so it's also special. To pass an
argument whose first character is <@>, surround that argument with single or
double quotes, otherwise it will be taken as a name of a response file which
holds the actual command line.
File: djgppfaq.info, Node: Long commands, Next: How long, Prev: Special chars, Up: Command line
16.4 How to pass command lines longer than 126 characters
=========================================================
**Q*: Can I invoke my program with a command line longer than the infamous
DOS 126-character limit?*
**Q*: I have a Makefile of Unix origin which contains some *very* long
command lines. Will it work with DJGPP?*
*A* : Yes and yes. DJGPP supports several methods of passing command-line
arguments which allow it to work around the DOS 126-character limit. These
* The `!proxy' method. If you invoke the program from within another
DJGPP program (like Make or Gcc compilation driver), it gets the address
of the memory block where the actual command line is stored. The
start-up code will detect this and use that info to retrieve the
command-line arguments.
This method is suitable only for invoking DJGPP programs from other DJGPP
programs. You don't have to do anything special to use this method, it
is all done automagically for you by the library functions like
`system', `spawnXX' and `execXX' on the parent program side, and by the
start-up code on the child side. (1) (*note Long commands-Footnotes::)
* The response file method. Any argument which starts with a <@>
character (like in `myprog @file') will cause the named `file' to be
read and its contents used as command-line arguments, like in many
DOS-based compilers and linkers. If you invoke your DJGPP program from
the DOS command line, this would be the only method available for you to
pass long command lines (like when calling `Gawk' or `Sed' without `-f'
option).
Note that this method makes <@> special when it is the first (or the
only) character of a command-line argument, which should be
escape-protected if you want to use it verbatim (*note how to pass the @
character: Special chars.).
Of course, if the start-up code doesn't see any of the above methods, it will
use the command line by default.
File: djgppfaq.info, Node: Long commands-Footnotes, Up: Long commands
(1) In case you wonder, the name `!proxy' comes from the the string which
identifies the use of this method: instead of getting the actual command
line, the program gets `!proxy' followed by the address of the actual command
line.
File: djgppfaq.info, Node: How long, Next: Makefiles, Prev: Long commands, Up: Command line
16.5 What is the maximum length of command line under DJGPP
===========================================================
**Q*: What is the longest command line I can pass to gcc when it is invoked
by `Make'?*
*A* : The arguments are passed to DOS Exec call (Int 21h function 4Bh) via
the transfer buffer which is 16KB-long. Apart of the command line, it is
also used to pass other info, such as the `!proxy' parameters and the copy of
the environment for the child program (let's say, less than 2000 bytes in
most cases, but your mileage may vary). This leaves at least 13K bytes for
arguments (including a separating blank between any two arguments). So
unless your arguments span more than 160 screen lines, you shouldn't worry.
However, if your environment is *very* large (some people need as much as 6KB
to accommodate for all the variables used by the various packages installed
on their machine), be sure to stub-edit the programs that spawn other
programs to larger transfer buffer, or else they could fail.
The above limit depends on the size of the transfer buffer, so check the size
of the value recorded in the stub header of the *parent program* before you
pass extremely long command lines to its children. GCC is the first program
you should worry about, because the linker (`ld.exe') usually gets long
command lines from GCC (they include the list of all the object files and
libraries to be linked).
File: djgppfaq.info, Node: Makefiles, Prev: How long, Up: Command line
16.6 Why Make passes only 126 characters to programs?
=====================================================
**Q*: I use Make to compile with GCC, but GCC gets only the first 126
characters of its command line. Didn't you just explain in so many words
that invoking a DJGPP program (GCC) from another DJGPP program (Make) can
safely pass up to 13K characters of command-line arguments using the `!proxy'
method?*
*A* : Check your Makefile for `SHELL = command.com' statements, or for
commands which include pipe or redirection characters like `>', `|', etc. If
Make sees any such statements, it will invoke `COMMAND.COM' to run GCC, and
`COMMAND.COM' can't pass more than 126 characters to GCC. To work around,
comment-out the `SHELL=' line, and change your commands to work without
redirection/pipe characters. One easy way to get rid of redirection
characters without losing their effect is to use the `redir' program which
comes with DJGPP. For example, the following command:
frobnicate foo.bar > myfile.tmp
can be re-written instead like this:
redir -o myfile.tmp frobnicate foo.bar
File: djgppfaq.info, Node: Converting, Next: Low-level, Prev: Command line, Up: Top
17. Converting DOS Programs/Libraries to DJGPP
**********************************************
If you have a program or a library developed under some other DOS-based
compiler, which you want to port to DJGPP, read this chapter.
* Menu:
* Syntax:: The (AT&T) syntax of Gas is different.
* Gas bugs:: Don't trust Gas!
* Converting ASM:: Automated conversion tool.
* ASM GPF:: When converted code crashes.
* OBJ and LIB:: You can't use them with GCC.
* 16-bit code:: ...or can you?
* NEAR and FAR:: How to convert these to DJGPP.
File: djgppfaq.info, Node: Syntax, Next: Gas bugs, Prev: Converting, Up: Converting
17.1 GCC/Gas won't accept valid assembly code ...
=================================================
**Q*: I have some code written in assembly which compiles under `MASM' and
`TASM', but GCC gives me a long list of error messages.*
*A* : The GNU Assembler (`as.exe'), or `Gas' called by GCC accepts "AT&T"
syntax, which is different from "Intel" syntax. Notable differences between
the two syntaxes are:
* AT&T immediate operands are preceded by `$'; Intel immediate operands
are undelimited (Intel `push 4' is AT&T `pushl $4').
* AT&T register operands are preceded by `%'; Intel register operands are
undelimited. AT&T absolute (as opposed to PC-relative) `jump'/`call'
operands are prefixed by `*'; they are undelimited in Intel syntax.
* AT&T and Intel syntax use the opposite order for source and destination
operands. Intel `add eax, 4' is `addl $4, %eax' in AT&T syntax.
The `source, dest' convention is maintained for compatibility with
previous Unix assemblers, so that GCC won't care about the assembler with
which it is configured, as some of GCC installations (on systems other
than MS-DOS) don't use GNU Binutils.
* In AT&T syntax, the size of memory operands is determined from the last
character of the opcode name. Opcode suffixes of `b', `w', and `l'
specify byte (8-bit), word (16-bit), and long (32-bit) memory
references. Intel syntax accomplishes this by prefixing memory operands
(*not* the opcodes themselves) with ``byte ptr'', ``word ptr'', and
``dword ptr'.' Thus, Intel `mov al, byte ptr FOO' is `movb FOO, %al' in
AT&T syntax.
* Immediate form long jumps and calls are `lcall/ljmp $SECTION, $OFFSET'
in AT&T syntax; the Intel syntax is `call/jmp far SECTION:OFFSET.'
Also, the far return instruction is `lret $STACK-ADJUST' in AT&T syntax;
Intel syntax is `ret far STACK-ADJUST.'
* The AT&T assembler does not provide support for multiple-section (aka
multi-segment) programs. Unix style systems expect all programs to be
single-section.
* An Intel syntax indirect memory reference of the form
SECTION:[BASE + INDEX*SCALE + DISP]
is translated into the AT&T syntax
SECTION:DISP(BASE, INDEX, SCALE)
Examples:
*Intel:* [ebp - 4] *AT&T:* -4(%ebp)
*Intel:* [foo + eax*4] *AT&T:* foo(,%eax,4)
*Intel:* [foo] *AT&T:* foo(,1)
*Intel:* gs:foo *AT&T:* %gs:foo
For a complete description of the differences, get and unzip the files named
`as.iN' (where `N' is a digit) from the bnu252b.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bnu252b.zip archive, then
see *Note i386-dependent features: (as)i386-Dependent. If you don't read
this FAQ with an Info browser, type at the DOS prompt:
info as machine i386
You will see a menu of `Gas' features specific to x86 architecture.
A guide is available which was written by Brennan Mr. Wacko Underwood
<brennan@mack.rt66.com>; it describes how to use inline assembly programming
with DJGPP and includes a tutorial on the AT&T assembly syntax. Check out
the DJGPP inline assembly tutorial, at this URL:
http://www.rt66.com/~brennan/djgpp/djgpp_asm.html
File: djgppfaq.info, Node: Gas bugs, Next: Converting ASM, Prev: Syntax, Up: Converting
17.2 Double-check code produced by Gas
======================================
**Q*: My assembly code gets corrupted by `Gas'!*
*A* : When writing assembly code, you should remember *to not trust Gas!*
You should always check that it does what you expect it to do. GNU Assembler
can currently be trusted only when it assembles code produced by GCC. All
other code--yours--is subject to the introduction of subtle errors. To be
sure, use a debugger to check the code (even `objdump' from GNU Binutils
doesn't always treat segment overrides correctly). The following lists some
guidelines for safer machine-language programming with `Gas':
a. Use explicit sizing. E.g., use `movl' instead of `mov', even if you're
sure the arguments are 32-bit wide. The fact that you use byte
registers doesn't seem to matter with `Gas.'
b. Write code segment overrides as `.byte' constants, not as e.g. `%cs:.'
According to Charles Sandmann <sandmann@clio.rice.edu>, `Gas' uses the
current phase of the moon in deciding whether to ignore your prefixes.
So unless you know *exactly* what the phase of the moon is at the moment
of assembly, use `.byte' constants.
c. Make sure the operands match the instructions. Don't assume that if they
don't, you'll get an error message from the assembler.
File: djgppfaq.info, Node: Converting ASM, Next: ASM GPF, Prev: Gas bugs, Up: Converting
17.3 Converting Intel ASM syntax to AT&T syntax
===============================================
**Q*: Where can I find an automated conversion tool to convert my
`Intel'-style assembly code into a code acceptable by `Gas'?*
*A* : A `Sed' script which should do most of the conversion was posted to
the DJGPP news group in the past. You can find it in the DJGPP archives, at
this URL:
http://www.delorie.com/djgpp/mail-archives/djgpp/1995/06/06/05:48:34
A conversion program called `TA2AS' which can convert TASM assembly source to
the AT&T format, can be found on the Oulu repository and on the DJGPP server,
e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/ta2asv08.zip and on the Oulu
repository, e.g. ftp://x2ftp.oulu.fi/pub/msdos/programming/convert/ta2as.zip.
`TA2AS' was written by Jan Oonk <jan@stack.urc.tue.nl>.
Alternatively, here is what you can do to convert your code:
* For a small number of relatively short files, consider converting them
with a smart editor (like Emacs or its work-alikes).
* Obtain a copy of Microsoft MASM 6.11. It has a `-coff' option to
generate object code in COFF format which can be submitted to GCC, so you
can compile your original source. You can also use the `LIB32'
librarian from Microsoft C8 to convert object files to COFF by putting
them into a `.lib' library, then extracting them as COFF files. (1)
(*note Converting ASM-Footnotes::)
* Use a disassembler to disassemble the object code, then convert it to
the AT&T format either by hand or using `TA2AS'. One place to look for
such a disassembler is on SimTel mirrors, e.g.
ftp://ftp.simtel.net/pub/simtelnet/msdos/disasm/.
Keep in mind that syntax is only one of the aspects of converting code
written for DOS to DJGPP. You should also make sure your code doesn't
violate any of the rules for protected-mode programming (*note next question:
ASM GPF.).
File: djgppfaq.info, Node: Converting ASM-Footnotes, Up: Converting ASM
(1) If you use MASM or LIB32, please post your experiences to
comp.os.msdos.djgpp news group, so that I can make the above instructions
less vague.
File: djgppfaq.info, Node: ASM GPF, Next: OBJ and LIB, Prev: Converting ASM, Up: Converting
17.4 Converted code GP Faults!
==============================
**Q*: OK, I've succeeded in converting and compiling my assembly-language
program, but when I run it, I get "Segmentation Violation" and "General
Protection Fault". This program works when compiled with MASM, so how can
this be?*
*A* : In DJGPP, your program runs in *protected mode*. There are certain
things you can't do in protected-mode programs (that's why it is called
protected mode). This issue is too complex to describe here, so only a few
of the more important aspects will be briefly mentioned. If you are serious
about writing assembly language protected-mode code, or have a large body of
existing code to convert to protected mode, you should read any of the
available books about protected-mode programming with 80x86 processors.
Here is a short list of some of the techniques found in many real-mode
programs, which will trigger protection violation or erratic behavior in
protected mode:
* Loading arbitrary values into segment registers, then using them to
reference code or data.
* Referencing code with data segment register, or vice versa.
* Assuming certain locations (like BIOS area or video memory) will be found
at certain absolute addresses.
* Calling DOS or BIOS services with `INT NN' instruction.
File: djgppfaq.info, Node: OBJ and LIB, Next: 16-bit code, Prev: ASM GPF, Up: Converting
17.5 I want to use a `.obj' or `.lib' code with DJGPP
=====================================================
**Q*: I have a set of useful functions in a `.obj' format, but no source
code. Can I use them with my DJGPP program?*
**Q*: I have this `ACMELUXE.LIB' library of functions which I want to use.
I've extracted all the `.obj' files, but when I try to link them with my
program, GCC complains: "File format not recognized". Can't I use these
object files?*
**Q*: I've got a bunch of `.obj' files I want to use. I've ran AR to make a
GCC-style `.a' object library, but got an error message from GCC saying
"couldn't read symbols: No symbols". How can I link them with my code?*
*A* : Sorry, you probably can't. The GNU linker called by GCC doesn't
understand the format of `.obj' files which other DOS-based
compilers/assemblers emit. Unless you can get the source of those functions,
convert it to protected-mode, flat-address model code and compile them with
GCC, you most probably won't be able to use them. (1) (*note OBJ and
LIB-Footnotes::)
Lately, an automated conversion tool called `OBJ2COFF' was written by the
SPiRiT team, which can be used to convert `.obj' object files and `.lib'
libraries to `COFF' format, provided that the original `.obj' files have been
written for flat-address memory model. (You can also try using LIB32
librarian from Microsoft C8 to convert object files to COFF.) The main
problem, of course, is that most such object files were written for real-mode
programs in memory models other than flat, and without extensive
modifications would crash your program anyway... (*Note previous question:
ASM GPF.)
`OBJ2COFF' is available from the Oulu repository, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/convert/o2cv10.arj and from DJ
Delorie's ftp server, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/o2cv06.arj.
If you have any problems with it or questions about it, send them to its
author, Rico <mb002@hi.ft.hse.nl> or to George van Venrooij
<george@il.ft.hse.nl>.
Another conversion tool you might try is `EMXAOUT' from the `emx/gcc'
package. It also requires the code to be written for the flat-address memory
model and will reportedly complain if you feed it with code written for
segmented memory models. `EMXAOUT' is available from the SciTech Software
FTP site, e.g. ftp://ftp.scitechsoft.com/devel/emxaout1.zip. If you need,
you should be able to compile it with DJGPP; however, a precompiled binary is
available in the above archive. Or you can get `EMXAOUT' from the EMX
archives, e.g. ftp://ftp-os2.nmsu.edu/os2/unix/emx09b/emxrt.zip and the RSX
extender (for running `EMXAOUT' under DPMI) from the RSX archives, e.g.
ftp://ftp.uni-bielefeld.de/pub/systems/msdos/misc/rsx503rt.zip.
File: djgppfaq.info, Node: OBJ and LIB-Footnotes, Up: OBJ and LIB
(1) Note that mixing object files from different compilers usually won't
work, even if they both are in the `.obj' format.
File: djgppfaq.info, Node: 16-bit code, Next: NEAR and FAR, Prev: OBJ and LIB, Up: Converting
17.6 I *must* use my 16-bit code with DJGPP!!
=============================================
**Q*: If that's how it is, then I would have to give up using DJGPP. I
simply cannot live without these `.obj' files. Are you *really* sure there
is nothing I can do??*
*A* : If you need your old code *that* badly, then there might be a way,
albeit a cumbersome one. You can write a 16-bit, real-mode program and link
it with your precious functions you can't live without. Have this program
spawn a DJGPP-compiled program and make the two communicate with each other
via a buffer allocated in low memory, or via command-line parameters passed
to the 32-bit program by the `spawnXX' function call. You can also call
16-bit functions directly with the library function called
`__dpmi_simulate_real_mode_procedure_retf', provided the 16-bit program
passes the CS:IP values of these functions to the 32-bit program. You can
even put your 16-bit code as binary instructions into a buffer allocated in
low memory and call it with `__dpmi_simulate_real_mode_procedure_retf' (but
if you can do that, you can probably also disassemble the code into a source
form and submit it to `Gas').
*Now* will you consider sticking with DJGPP? *Please??...*
File: djgppfaq.info, Node: NEAR and FAR, Prev: 16-bit code, Up: Converting
17.7 What should I do with those "near" and "far" declarations?
===============================================================
**Q*: I have this program that I need to port to DJGPP, but it is full of
pointers and functions declared with the "near" and "far" keywords which GCC
doesn't grok. What shall I do?*
**Q*: A program written for a 16-bit compiler uses the MK_FP or _MK_FP macro,
but DJGPP doesn't seem to have it. How should I port it?*
*A* : In DJGPP you use a flat address space with no segmentation, so you
don't need far pointers in the sense they are used in 16-bit code. Just
define away those keywords and you will be fine:
#define far
#define near
#define huge
#define _far
#define _near
#define _huge
Alternatively, you could add suitable `-D' switches to the GCC command line,
like this:
gcc -Dfar -Dnear -Dhuge -c myprog.c
Macros that create far pointers from the segment and offset (usually called
`MK_FP' or `_MK_FP') are mostly used in 16-bit code to access certain
absolute addresses on memory-mapped peripheral devices, like the video RAM.
These chores are done differently in DJGPP; the details are described in
*Note accessing absolute addresses: Xfer, below. You will need to rewrite
the code that uses these macros, so don't bother writing a replacement for
the macro itself.
Macros that extract the segment and the offset from a far pointer (called
`FP_SEG' and `FP_OFF') are required in 16-bit code to pass addresses in
registers when calling real-mode DOS or BIOS services, like functions of
interrupt 21h. See *Note How to call real-mode interrupt functions: Pointer
segment, which describes how that should be done in DJGPP; here, too, you
won't need to port the above macros.
File: djgppfaq.info, Node: Low-level, Next: Legalese, Prev: Converting, Up: Top
18. Low-level DOS/BIOS and Hardware-oriented Programming
********************************************************
This chapter sheds some light on a few aspects of writing DJGPP programs
which interact with hardware or use interrupts.
* Menu:
* int86:: It doesn't always work.
* Pointer segment:: Some interrupts require it, but how do you get it?
* Zero SP:: If you don't, your program crashes.
* Xfer:: Moving data to and from conventional memory.
* 20 bits:: You should mask off the upper 12 bits when unused.
* Fat DS:: Fast direct access to memory-mapped devices.
* Above 1MB:: Interact with memory-mapped devices above 1MB.
* RMCB:: How to let DOS/BIOS call your code.
* Hardware interrupts:: How to hook HW interrupts from DJGPP.
* _go32 vs __dpmi:: Which functions should you use?
* HW Int pitfalls:: Does your machine wedge? Here are some reasons.
* Ports:: Reading and writing I/O ports in DJGPP.
* Inline Asm:: How to write inline assembly with GCC.
File: djgppfaq.info, Node: int86, Next: Pointer segment, Prev: Low-level, Up: Low-level
18.1 Got "Unsupported INT 0xNN" calling `int86'
===============================================
**Q*: Why does my program crash with "Unsupported DOS request 0xNN" or
"Unsupported INT 0xNN" when I call `int86' or `intdos' functions to invoke a
software interrupt?*
*A* : Calling real-mode DOS or BIOS services from protected-mode programs
requires a switch to real mode, so the `int86' family of functions in the
DJGPP library should reissue the INT instruction after the mode switch.
However, some services require pointers to memory buffers. Real-mode
DOS/BIOS functions can only access buffers in conventional memory, so `int86'
has to move data between your program and low memory to transparently support
these services. But this means it should know about all these services to
perform these chores correctly, because each service has its own layout and
size of the buffer(s). While `int86' supports many of these services, it
doesn't support all of them. The supported functions are listed in the
library reference. *Note int86 library reference: (libc.inf)int86. For
those it doesn't support, you will have to call the `__dpmi_int' library
function instead. It is also documented in the library reference, *Note
__dpmi_int: (libc.inf)__dpmi_int. `__dpmi_int' requires that you set up all
the data as required by the service you are calling, including moving the
data to and from low memory (*Note how to use buffers with DOS/BIOS services:
Pointer segment, below).
File: djgppfaq.info, Node: Pointer segment, Next: Zero SP, Prev: int86, Up: Low-level
18.2 How to use buffers with DOS/BIOS services
==============================================
**Q*: I want to call a DOS/BIOS function which requires a pointer to a buffer
in, e.g. `ES:DI' (or any other) register pair. How do I get the segment to
put into the `ES' register?*
*A* : If you use `int86x' or `intdosx' for a DOS or BIOS function supported
by them, then just put the address of your buffer into the register which
expects the offset (`regs.x.di') and forget about the segment. These
functions are processed specially by the library, which will take care of the
rest.
If you call `__dpmi_int', then you must put into that register pair an
address of some buffer in *conventional* memory (in the first 1 MByte). If
the size of that buffer doesn't have to be larger than the size of transfer
buffer used by DJGPP (16KB by default), then the easiest way is to use the
transfer buffer. (Library functions don't assume its contents to be
preserved across function calls, so you can use it freely.) That buffer is
used for all DOS/BIOS services supported by DJGPP, and it resides in
conventional memory. DJGPP makes the address and the size of the transfer
buffer available for you in the `_go32_info_block' external variable, which
is documented the library reference. Check the size of the buffer (usually,
16K bytes, but it can be made as small as 2KB), and if it suits you, use its
linear address this way:
dpmi_regs.x.di =
_go32_info_block.linear_address_of_transfer_buffer & 0x0f;
dpmi_regs.x.es =
(_go32_info_block.linear_address_of_transfer_buffer >> 4) & 0xffff;
For your convenience, the header file `<go32.h>' defines a macro `__tb' which
is an alias for `_go32_info_block.linear_address_of_transfer_buffer.'
If the size of the transfer buffer isn't enough, you will have to allocate
your own buffer in conventional memory with a call to the
`__dpmi_allocate_dos_memory' library function. It returns to you the segment
of the allocated block (the offset is zero). If you only need a small number
of such buffers which can be allocated once, then you don't have to worry
about freeing them: they will be freed by DOS when your program calls `exit.'
For bullet-proof code, you should test the size of the transfer buffer at
runtime and act accordingly. This is because its size can be changed by the
`STUBEDIT' program without your knowledge.
File: djgppfaq.info, Node: Zero SP, Next: Xfer, Prev: Pointer segment, Up: Low-level
18.3 How to call software interrupt functions
=============================================
**Q*: My program crashes/doesn't do what it should when I call
`__dpmi_simulate_real_mode_interrupt.'*
*A* : You should zero out some of the fields of the `__dpmi_regs' structure
before you call that function. Random values in these fields can cause your
program to behave erratically. The fields in point are `SS', `SP' and
`FLAGS.' When `SS' and `SP' are zeroed, the DPMI host will provide a stack
for the interrupt handler. This stack is locked and is 4KB-long for any
handling done in protected mode (such as real-mode callbacks), and at least
512 bytes in size for interrupts reflected into real mode. This is usually
enough, but sometimes you'll need to use your own, larger stack, e.g., if you
expect interrupts to nest, or if your handler needs a lot of stack space.
(1) (*note Zero SP-Footnotes::) In these cases you should point `SS' and
`SP' to a larger buffer which is in conventional memory (possibly part of the
transfer buffer).
If `SS:SP' isn't zero, it will be used as the address of the stack you want
to be used by the interrupt handler, so if it points to a random location,
your program will crash. A non-zero `FLAGS' field can also make the
processor do all kinds of weird things (e.g., imagine that the single-step or
the debug bit is set!).
If you don't have any reason to set `SS:SP' to your stack, it's easier to
call the `__dpmi_int' library function, which zeroes out the stack pointer
and the `FLAGS' fields for you (and also doesn't force you to type long
function names!).
File: djgppfaq.info, Node: Zero SP-Footnotes, Up: Zero SP
(1) The DPMI spec indicates that you should *not* use the default stack if
your procedure/interrupt handler uses more that 60 bytes, or 1/8 of the total
stack space available by default.
File: djgppfaq.info, Node: Xfer, Next: 20 bits, Prev: Zero SP, Up: Low-level
18.4 How to move data between your program and conventional memory?
===================================================================
**Q*: How can I move data between my program and the transfer buffer?*
**Q*: How do I access my peripheral card which is memory-mapped to an address
between 640K and 1M?*
**Q*: How can I read or change a value of one of the variables in the BIOS
data area?*
**Q*: How can I peek at an address whose far pointer I get from an INT 21h
call?*
*A* : Depending on your specific needs, you can use one of three methods:
* If you want to access a byte, a 16-bit word, or a 32-bit double word, use
the "far pointer" functions declared on the the `<sys/farptr.h>' header
file. You should convert any real-mode far pointer segment:offset pair
into a "linear address" (i.e., segment*16 + offset), and use the
`_dos_ds' macro to get the selector which allows access to conventional
memory, like this:
unsigned char value = _farpeekb(_dos_ds, segment*16 + offset);
Use `_farpeekw' to peek at 16-bit shorts and `_farpeekl' to peek at
32-bit longs. If you need to access several (non-contiguous) values in
a loop, use the corresponding `_farnspeekX' functions which allow you to
set the selector only once, as opposed to passing it with every call
(but be sure the loop doesn't call any function that itself sets the
selector; see the library reference for more details).
There is a corresponding set of `_farpokeX' and `_farnspokeX' functions
to poke (change the values of) such memory locations.
These functions have an advantage of emitting inline assembly code when
you compile with optimizations, so they are very fast. See the library
reference Info file for further details about these functions.
* If you need to access more than 4 contiguous bytes, use `dosmemget' and
`dosmemput' library functions. They also require you to convert the
segment:offset pair into a linear address, but they don't need the
conventional memory selector, as they can only be used to access the
conventional memory.
Note that some memory-mapped peripheral devices might require 16-bit word
accesses to work properly, so if `dosmemXXX' yields garbled results, try
`dosmemXXXw' or "farptr" functions.
* For moving buffers larger than a few tens of bytes, it's best to use
`movedata' library function. It requires that you pass selector and
offset for both the conventional memory address and for the buffer in
your program's address space. Use the `_my_ds' function to get the
selector of any variable in your program, and use the address of the
variable (cast to an `int') as its "offset" or linear address.
`movedata' is faster because it moves by 32-bit longs, but be careful
with its use when moving data to and from peripheral cards: some of them
only support 8- or 16-bit wide data path, so moving data 4 bytes at a
time won't gain you much, and might even get you in trouble with some
buggy BIOSes. The functions `movedatab' and `movedataw' are provided
for moving by bytes and by 16-bit words, respectively.
* For the fastest access to memory outside your usual flat address space,
you might consider using the "nearptr" functions declared on the
`<sys/nearptr.h>' header; see the library reference for more details.
Also see the description of how to get the *Note fastest direct access
to peripheral devices: Fat DS, below.
File: djgppfaq.info, Node: 20 bits, Next: Fat DS, Prev: Xfer, Up: Low-level
18.5 Conventional-memory addresses use only 20 bits
===================================================
**Q*: I call `movedata' to pass data between my program and the transfer
buffer, but get bogus values or General Protection Fault.*
*A* : Valid conventional-memory addresses are only 20 bit-wide. However,
the value stored in the variable
`_go32_info_block.linear_address_of_transfer_buffer' (or its alias, `__tb')
is not guaranteed to have the higher 12 bits zeroed, and `movedata' doesn't
mask those high bits, because it can also be used to move data between 2
protected-memory locations. Be sure to mask off the high 12 bits of the
value returned by various `..._linear_address_...' fields in DJGPP
structures, whenever that address references a conventional memory location,
before you call *any* of the functions from the `movedataX' family, the
"farptr" or the "nearptr" functions.
File: djgppfaq.info, Node: Fat DS, Next: Above 1MB, Prev: 20 bits, Up: Low-level
18.6 Fast access to memory-mapped devices or absolute addresses
===============================================================
**Q*: The "farptr" functions are too slow for my application which *MUST*
have direct access to a memory-mapped device under DPMI. How can I have this
in DJGPP? My entire optimized graphics library is at stake if I can't! :(*
*A* : The following so-called Fat DS method was suggested by Junaid A.
Walker <junaid@barney.eng.monash.edu.au> (he also posted a program which uses
this technique to access the video RAM; you can look it up by searching the
mailing list archives). But first, a word of warning: the method I'm about
to describe effectively disables memory protection, and so might do all kinds
of damage if used by a program with a wild pointer. Or, as Stephen Turnbull
<turnbull@shako.sk.tsukuba.ac.jp> has put it:
*Surgeon General's WARNING*: The description below uses the "Fat DS
hack", a steroid derivative which gives your program great strength, a
thick neck, baldness, and is known to be closely linked with the
Alzheimer's disease.
Having said that, here is the trick: you change the limit of the segment
descriptor stored in `DS' to `0xffffffff' (i.e., -1), using function 8 of the
DPMI interrupt 31h. After that, you have access to all the memory which is
currently mapped in. You then use the 32-bit wrap-around in the linear
address space to access memory at, say, linear address 0xa0000 (which belongs
to the VGA), or any other address on your memory-mapped device.
You should know up front that this trick won't work with every DPMI host.
Linux's DOSEmu and Win/NT won't allow you to set such a huge limit on the
memory segment, because these operating systems take memory protection
seriously; in these cases `__djgpp_nearptr_enable' will return zero--a sign
of a failure. CWSDPMI, QDPMI, Win 3.x and Win 9x all allow this technique
(OS/2 Warp seems to allow it too, at least as of version 8.200), but some
events break this scheme even for those DPMI hosts which will allow it. A
call to `malloc' or any other library function which calls `sbrk' might
sometimes change the base address of the `DS' selector and break this method
unless the base address is recomputed after `sbrk' call. (The "nearptr"
functions support this recomputation by providing you with the
`__djgpp_conventional_base' variable, but it is your responsibility to use
it.) The same change happens when you call `system', and as a result of some
other events external to the executing code thread, like multitasking or
debugger execution.
You should also know that the `__djgpp_nearptr_enable' function currently
doesn't verify that the limit was properly set. So if the DPMI server would
fail the call *silently*, the function won't detect it and will not return a
failure indication (but we don't know about any such DPMI server).
If you are aware of these limitations, and don't need your code to run under
all DPMI hosts, it might be the fix to your problems.
Confused about how exactly should you go about using this technique in your
program? Look at the docs of the "nearptr" functions, *Note
__djgpp_nearptr_enable: (libc.inf)__djgpp_nearptr_enable.
Another possibility is to use the DPMI function `0x508' that can map any
range of physical memory addresses into a block that you allocate. Note that
this is a DPMI 1.0 functionality which is *not* supported by most DPMI 0.9
hosts (`CWSDPMI' does support it). There is a helper function
`__djgpp_map_physical_memory' in the DJGPP C library that you can use to call
these services.
File: djgppfaq.info, Node: Above 1MB, Next: RMCB, Prev: Fat DS, Up: Low-level
18.7 Accessing absolute address above 1MB
=========================================
**Q*: How can I access memory-mapped peripheral devices (or any other
absolute address) above 1 MByte mark?*
*A* : Use the `__dpmi_physical_address_mapping' library function. It
returns a linear address which can be used to access a given absolute
physical address. You can then use the functions from <sys/farptr.h> to
access that linear address. If you prefer to create the mapping yourself,
these are the DPMI calls that you will have to use:
- allocate an LDT descriptor (Int 31h/AX=0);
- map selector to physical address (Int 31h/AX=0800h);
- lock linear address (Int 31h/AX=0600h);
- set segment base address (Int 31h/AX=7);
- set segment limit (Int 31h/AX=8).
All of these DPMI calls have `__dpmi__XXX' wrappers in the DJGPP library.
File: djgppfaq.info, Node: RMCB, Next: Hardware interrupts, Prev: Above 1MB, Up: Low-level
18.8 How to make DOS/BIOS call your function
============================================
**Q*: How can I make any real-mode service call my function? E.g., the mouse
driver has a provision (function 0Ch) to call a user-defined handler when
certain events occur, which expects a far pointer to my function in the
`ES:DX' register pair.*
*A* : Those services expect a real-mode function, so you should wrap your
protected-mode function with a real-mode stub. To this end, call either the
`_go32_dpmi_allocate_real_mode_callback_retf' or the
`_go32_dpmi_allocate_real_mode_callback_iret' library function, as required
by the real-mode service you want to hook, and pass the `segment' and
`offset' fields it returns to the service you want (in the above example, Int
33h function 0Ch) by calling `__dpmi_int.' See the docs in the library
reference Info file for further details about allocating wrapper function.
File: djgppfaq.info, Node: Hardware interrupts, Next: _go32 vs __dpmi, Prev: RMCB, Up: Low-level
18.9 How to hook hardware interrupts
====================================
**Q*: How do I register my DJGPP function as a hardware interrupt handler?*
*A* : The optimal set-up depends on the interrupt frequency and on the
amount of processing it requires. Therefore, only some basic considerations
and techniques are listed below. What combination of these is best for your
application is up to you to decide.
First, some background. Hardware interrupts can occur when the processor is
either in real mode (like when your program calls some DOS service) or in
protected mode. When your program runs under a DPMI host, hardware
interrupts are always passed to protected mode first, and only if unhandled
are they reflected to real mode. Therefore, in DPMI mode you can get away
with installing only a protected-mode handler. However, if the interrupts
happen at a high frequency (say, more than 10 KHz), then the overhead of the
interrupt reflection from real to protected mode might be too painful, and
you might consider installing a real-mode interrupt handler in addition to
the protected-mode one. If you do, you must hook the PM interrupt first,
then the RM one (because hooking the PM interrupt modifies the RM one). Also,
you should know that some DPMI hosts don't allow you to hook the RM interrupt
(CWSDPMI does); the only way to be sure is to try.
To install a protected-mode interrupt handler, you do this:
* In general, your handler should be written in assembly to be
bullet-proof. It should lock all the memory (code, data and stack) it
touches during interrupt processing (this is virtually impossible in C),
explicitly issue the `STI' instruction before `IRET' and perform all the
other chores described in the DPMI spec (*note DOS Protected Mode
Interface Specification: DPMI Spec.). To install assembly handler, you
should do this:
- Call `__dpmi_get_protected_mode_interrupt_vector' and save the
structure it returns (to restore the previous handler address
before your program exits).
- Lock all the memory your handler touches with a series of calls to
`__dpmi_lock_linear_region.'
- Finally, call `__dpmi_set_protected_mode_interrupt_vector' passing
it the pointer to a `__dpmi_paddr' structure filled with `_my_cs'
in the `selector' field and the address of your function in the
`offset32' field.
* If your handler function is written in C, you should generally call the
`_go32_dpmi_XXX' functions instead of the bare-bones API wrappers whose
names start with `__dpmi_.' Specifically:
- Call `_go32_dpmi_get_protected_mode_interrupt_vector.' This
function puts the selector and offset of the specified interrupt
vector into the `pm_selector' and `pm_offset' fields of the
structure pointed to by its second argument. This data should be
saved and later passed to
`_go32_dpmi_get_protected_mode_interrupt_vector' to restore the
vector on exit.
- Call `_go32_dpmi_allocate_iret_wrapper,' passing it the address of
your functions in the `pm_offset' field and the value of `_my_cs'
in the `pm_selector' field. The `pm_offset' field will get
replaced with the address of the wrapper function which is a small
assembler function that handles everything an interrupt handler
should do on entry and before exit (and what the code GCC generates
for an ordinary C function doesn't include); the effect is similar
to using interrupt or `_interrupt' keyword in some DOS-based
compilers.
- If you want your handler to chain to the previous handler, call
`_go32_dpmi_chain_protected_mode_interrupt_vector.' This will set
up a wrapper function which, when called, will call your handler,
then jump to the previous handler after your handler returns. Put
the address of your handler into the `pm_offset' field and the
value of `_my_cs' into the `pm_selector' field of the
`_go32_dpmi_seginfo' structure and pass a pointer to it to this
function.
- You then call `_go32_dpmi_set_protected_mode_interrupt_vector' with
the address of the `_go32_dpmi_seginfo' structure you got either
from `_go32_dpmi_allocate_iret_wrapper' or from
`_go32_dpmi_chain_protected_mode_interrupt_vector.'
The problem with writing handlers in C as above is that the wrappers'
code and data aren't locked, and in practice you can't lock all of
memory the handler itself uses, either. Thus, this approach is
generally unsuitable for production-quality software and should be used
only when the program is known not to page (i.e., only the physical
memory is used). You might consider disabling virtual memory to make
sure your program doesn't page. To accomplish this, either set the
`_CRT0_FLAG_LOCK_MEMORY' bit in the `_crt0_startup_flags' variable, or
use `CWSDPR0' or `PMODE/DJ' as your DPMI host. In fact, using one of
these methods is the recommended way of debugging the first versions of
a program that hooks hardware interrupts; only after you are sure that
your basic machinery works should you move to testing it in a setup when
paging might happen.
Note that `_CRT0_FLAG_LOCK_MEMORY' is only recommended for small
programs that run on a machine where enough physical memory is always
available, because the startup code currently doesn't test if memory is
indeed locked, and you can end up with unlocked, or partially unlocked
memory, which will crash your program.
To install a real-mode interrupt handler, you do this:
* Call `__dpmi_get_real_mode_interrupt_vector' and save the structure it
returns (to restore the previous handler address before your program
exits).
* Allocate some conventional memory with `__dpmi_allocate_dos_memory' and
put the code of your handler there with the `dosmemput' function. (You
could also call one of the functions which allocate a real-mode
call-back, but these will cause a mode switch on every interrupt, which
you want to avoid; otherwise there is no point in installing a real-mode
handler, right?)
* Put the address which `__dpmi_allocate_dos_memory' returned into a
`__dpmi_raddr' structure (the lower 4 bits into `offset16' field, the
rest into `segment' field), then call
`__dpmi_set_real_mode_interrupt_vector.'
For examples of installing and using hardware interrupt handlers, see the
sample code written by Bill Currie <bill_currie@MAIL.TAIT.CO.NZ>, the Sound
Blaster interrupt-driven functions, the `mkkbd' package, and the `libhw'
library, described under *Note sample DJGPP packages: Samples. Alaric B.
Williams <@abwillms.demon.co.uk> has written a tutorial on DJGPP interrupt
handling, at this URL:
http://www.abwillms.demon.co.uk/prog/djints.txt
File: djgppfaq.info, Node: _go32 vs __dpmi, Next: HW Int pitfalls, Prev: Hardware interrupts, Up: Low-level
18.10 Should I use _go32_XXX or __dpmi_YYY functions?
=====================================================
**Q*: In v1.x I was used to the `_go32_...' functions, but now comes v2 which
also has `__dpmi_...' functions. Are there any differences between these two
varieties?*
**Q*: Do I need to convert my old v1.x code to use the new `__dpmi_...'
functions?*
*A* : These two groups of functions have different functionality, so don't
just substitute the new ones for the older ones, because it usually won't
work! The new `__dpmi_...' functions are just bare-bones wrappers of the
DPMI API calls (*note DPMI Specification: DPMI Spec.), generally unsuitable
for use with handlers written in C, whereas the old `_go32_...' functions are
intelligent helper functions which only make sense if your interrupt handlers
are C functions. The problem with the `_go32_...' functions is that they
don't lock all the code and data they (and your handlers) use, so they can
crash on memory-tight machines and thus aren't suitable for
production-quality code. But they are certainly useful in the initial stages
of writing and debugging code that hooks hardware interrupts, and for
migrating existing v1.x code to v2. Some of the old names were just
`#define'd' to the new names where the functionality is identical.
The bottom line is that it shouldn't be necessary to convert your code for it
to work at least as well as it did in v1.x; but if you want it to be more
stable, you should rewrite your handlers in assembly and use the new
`__dpmi_...' functions (*note How to install a hardware interrupt handler:
Hardware interrupts.).
File: djgppfaq.info, Node: HW Int pitfalls, Next: Ports, Prev: _go32 vs __dpmi, Up: Low-level
18.11 Hardware interrupt hooking has its subtleties ...
=======================================================
**Q*: I did all the above, but my program occasionally still hangs...*
*A* : Hooking hardware interrupts in DJGPP (and in protected mode in
general) has a few subtle aspects. In general, hardware interrupt handling
in DJGPP v2.0 is rock solid *if you play by the rules*. Unfortunately, the
rules are a bit tricky.
One cause of your problems might be that your interrupt handler or some
memory location it uses get paged out because of the virtual memory
mechanism, or because your program spawned a child program. In that case,
the interrupt might cause a call to a non-existent service routine, with the
obvious results. You should lock all the memory pages that your handler
accesses by calling the `__dpmi_lock_linear_region' library function. This
also means in practice that you should write your handler in assembly, as
described in *Note how to set an interrupt handler: Hardware interrupts,
above. You can disable virtual memory, or put `_CRT0_FLAG_LOCK_MEMORY' into
`_crt0_startup_flags' to make sure nothing is paged out (but then your
program might not have enough memory to run, unless you run on
memory-abundant systems).
Another problem might be that the hardware peripheral you use generates a lot
of interrupts. Due to specifics of hardware interrupts handling in protected
mode, there is a substantial overhead involved with reflection of interrupts
between real and protected modes. For instance, on a 486DX/33 this
reflection might consume up to 3000 clocks; on a 386SX/16, even a 1KHz clock
might eat up 1/2 of available cycles. If your hardware fires too many
interrupts, your CPU might not be able to keep up. In that case, consider
reducing the interrupt frequency, or move some of the processing done inside
the interrupt handler to some other place. Use a ring 0 DPMI server such as
`CWSDPR0' or `PMODE/DJ' which don't swap interrupt stacks--this will reduce
the overhead of the interrupt reflection to some degree. If your handler is
written in C, write it in assembly and make sure it doesn't chain. If that
doesn't help, install a real-mode handler.
Some losing memory managers, notably EMM386, were reported to induce a high
interrupt handling overhead. In one case, a user reported an increase in the
interrupt rate from 2 KHz to 6 KHz after uninstalling EMM386.
Still another possibility is that you use a non-default `sbrk' algorithm in
your program (check if the header file `crt0.h' is included anywhere in the
program, and if so, if the `_CRT0_FLAG_UNIX_SBRK' bit in the
`_crt0_startup_flags' variable is set by the program. If it is, then a
hardware interrupt which happens at the wrong time could crash your machine,
especially if you run under Windows 3.x.
You should also keep in mind that the DPMI server can decide to handle some
of the interrupts itself and not pass them to your program, although this is
rare. For example, Win95 won't pass the Ctrl-Alt-Del combination to your
keyboard interrupt handler, but will rather act on it itself; QDPMI sometimes
processes Ctrl-C presses so that your program never sees them, etc.
Sometimes, but not always, you can change some configuration option to make
some keys get to your handler (e.g., the Alt-TAB setting on the Win3.x `.PIF'
file).
If the above still doesn't explain your problem, then post your code on
comp.os.msdos.djgpp news group or the djgpp mailing list <djgpp@delorie.com>,
tell there how it fails and somebody will usually have a solution or a
work-around for you.
File: djgppfaq.info, Node: Ports, Next: Inline Asm, Prev: HW Int pitfalls, Up: Low-level
18.12 How to read and write ports
=================================
**Q*: I need to read from and write to PC ports, and I'm accustomed to using
the `inp' and `outp' functions. But I hear they aren't available in DJGPP?*
*A* : They are in v2.x. Just `#include <pc.h>' and you get their
prototypes. The functions themselves are in the default library. Note that
there are also size-specific versions for byte- word- and dword-long access
(e.g., `inportl' for reading a 32-bit dword), as well as functions to
read/write sequences of bytes and words, like `inportsb' and `outportsw';
these are DJGPP-specific.
File: djgppfaq.info, Node: Inline Asm, Prev: Ports, Up: Low-level
18.13 Inline Assembly code with GCC
===================================
**Q*: I am used to writing inline assembly with Borland C, but can't figure
out the way to do it with GCC...*
**Q*: How can I reference C variables from my inline assembly code?*
*A* : GCC has extensive inline assembly facilities. They allow you to
specify everything other compilers let you (like the registers where GCC will
put specific results), but in a way that doesn't disable compiler
optimizations of the code that includes inline assembly. Because of this
flexibility, the syntax of the inline assembly code is very different from
the other DOS-based compilers. The GCC on-line docs describe these
facilities in detail; to read the relevant sections, type this from the DOS
prompt:
info gcc "C Extensions" "Extended Asm"
(Note the quotes: they are important.) You will, of course, need that the
stand-alone info reader be installed on your system for the above command to
work. If it is not already installed, get the file `txi360b.zip' from the
DJGPP distribution and install it.
If you read this FAQ via WWW, you can also read about the GCC inline assembly
extensions with your Web browser, at this URL:
http://www.delorie.com/gnu/docs/gcc/gcc_86.html#SEC89
File: djgppfaq.info, Node: Legalese, Next: Help, Prev: Low-level, Up: Top
19. Legal Aspects
*****************
This chapter answers some questions about various legal aspects of writing
programs with DJGPP.
* Menu:
* Applications:: Legal restrictions of applications written with DJGPP.
* Redistribution:: Legal aspects of redistributing DJGPP itself.
File: djgppfaq.info, Node: Applications, Next: Redistribution, Prev: Legalese, Up: Legalese
19.1 Legal (un)restrictions on DJGPP applications
=================================================
**Q*: Can you explain in plain English the legal restrictions of distributing
programs compiled with DJGPP?*
**Q*: Can I write commercial programs with DJGPP?*
*A* : In most cases, you don't have to worry about any legal restrictions
when you compile your programs with DJGPP. Using the GNU C/C++ compiler
doesn't make your programs subject to *any* restrictions. The C library
which comes with DJGPP is *free*, which means you are free to use it in any
way you like (but please observe *Note basic rules of courtesy:
Redistribution.) So, if you write C programs, you have absolutely nothing to
worry about.
The basic C++ `iostream' class library (`libiostr.a') and the Standard
Template Library (`libstdcx.a') which come with DJGPP allow you to use them
binary-wise (i.e., without changing library sources) in your C++ programs
*without restrictions*, unless you compile your programs with a compiler
other than Gcc (which won't happen if you work with DJGPP). Only the library
of additional C++ classes (`libgpp.a') requires that you provide your
customers with source or object code of the application, so they could relink
the application with future or modified versions of the C++ library. (If you
intend to distribute commercial programs linked with the `libgpp.a' library,
you are strongly advised to read the GNU Library General Public License which
comes with the library, for rigorous definition of its terms.)
Note that `libiostr.a' library doesn't place your program under GPL or LGPL,
so if you only use C++ classes included in that library, make your
compilations use `libiostr.a' instead of `libgpp.a.' (That's the only reason
for having `libiostream.a' as a separate file, because `libgpp.a' includes
everything `libiostream.a' does, so you never need both of them.)
Two GNU packages, `Flex' and `Bison', are also special in that using them to
produce your programs doesn't place your programs under GPL or LGPL. In
other words, lexers produced by `Flex' and parsers produced by `Bison' do
*not* imply GPL/LGPL.
If you *do* use in your program any of the FSF sources that fall under
GPL/LGPL (like some of the GCC's sources, or the GNU `getopt' or `regex'
packages which come with many GNU programs), then you must comply with the
terms of GNU licenses when distributing your programs; in this case your
entire application becomes GPL. If that is unacceptable to you, consider
using the versions of `regex' and `getopt' from the DJGPP C library (which is
free).
You may ship any of the utilities developed specifically for DJGPP (e.g., the
floating-point emulator or the CWSDPMI DPMI host) *as distributed by DJ
Delorie* with your program with no other requirement besides telling your
customers how to get DJGPP for themselves.
Note that the above says nothing about the legal aspects of contributed
packages, like `GRX' and others; you will need to read their docs to find out.
File: djgppfaq.info, Node: Redistribution, Prev: Applications, Up: Legalese
19.2 Legal restrictions of DJGPP utilities and libraries
========================================================
**Q*: Can I redistribute djgpp, and if so, how?*
**Q*: I run a business that sells shareware for distribution costs. Can I
include djgpp on my CD-ROM?*
**Q*: I want to include djgpp in a product that happens to need a compiler
provided with it. Can I do this?*
**Q*: Is DJGPP GNU software?*
**Q*: Is DJGPP public domain software?*
**Q*: Is DJGPP shareware?*
*A* : DJGPP is *not* public domain, neither is it shareware (you *don't*
have to pay a license fee to use DJGPP). Parts of DJGPP (the compiler and
some of the development tools) *are* GNU software, so you must comply with
GNU GPL if you distribute those parts (usually, you won't need to distribute
them, because they are freely available to everyone). A small part of the C
library is taken from the Berkeley BSD sources, and is therefore in public
domain. Other parts of DJGPP, which include most of the C library, the free
DPMI host CWSDPMI, and some of the utilities, are copyrighted, but in a way
that allows you to use them freely and without restrictions.
When you redistribute DJGPP itself (as opposed to your programs compiled with
DJGPP), you must comply to the conditions applicable to whatever you
distribute. The parts which are in public domain are, of course, freely
distributable. Other parts of DJGPP fall under the DJGPP copyright which
allows you to redistribute everything provided you follow these rules:
* You must redistribute DJGPP as a whole, with all its parts, including
the sources to utilities and libraries that are part of DJGPP, unless
other arrangements are first made with DJ Delorie <dj@delorie.com>.
* Please make a good faith effort to stay up to date with the latest DJGPP
versions, so people don't get old versions with bugs that are long ago
solved, or, worse still, versions that are no longer supported.
* You must call it *DJGPP* and nothing else.
* You may *not* take credit for it, and you must *not* remove any notices
in DJGPP that give credit to those who worked on it.
* You must tell the recipient how to get the latest version off the
Internet, or at least how to find out what the latest version is.
DJ Delorie gets a lot of questions from people who got old versions from
vendors, and don't realize that they're way out of date.
* Distributing CWSDPMI with shareware or commercial programs requires
notification of its author Charles Sandmann <sandmann@clio.rice.edu> by
mail or acknowledged e-mail.
In addition, it would be a courtesy to inform DJ Delorie <dj@delorie.com>
that you are including DJGPP in your product, in case this information is
obsolete. A token sample of your distribution would be nice also.
File: djgppfaq.info, Node: Help, Next: v2, Prev: Legalese, Up: Top
20. Getting Help
****************
This chapter tells you how to get answers to questions you didn't find in
this FAQ.
* Menu:
* DJGPP isn't GNU:: Do *not* post to GNU News groups.
* Mailing list:: How to post to DJGPP mailing list.
* Subscribing:: You can see every posted article.
* Unsubscribing:: When it's too much to read...
* Silent list:: Is the list alive?
* Duplicates:: If you get duplicate messages.
* Newsgroup:: We prefer you use it instead of the
mailing list.
File: djgppfaq.info, Node: DJGPP isn't GNU, Next: Mailing list, Prev: Help, Up: Help
20.1 Don't post DJGPP-specific problems to GNU News groups
==========================================================
**Q*: I post my problem to the "help-gcc" News group, but don't get any
answers.*
*A* : Is your problem likely to be special to the DJGPP port or to the DOS
environment? If so, don't post to GNU Usenet groups, but to the
comp.os.msdos.djgpp news group or to the DJGPP mailing list
<djgpp@delorie.com>. People who read GNU News groups usually neither know
nor care about DOS-specific problems. Post there only if the problem seems
to be a generic one in one of the FSF utilities. For most problems, this can
be deduced only after either tracing a problem in the source code or testing
it on some non-DOS platform. As a general rule, always post to the DJGPP
group first.
File: djgppfaq.info, Node: Mailing list, Next: Subscribing, Prev: DJGPP isn't GNU, Up: Help
20.2 How to post to the mailing list
====================================
**Q*: How do I post to the DJGPP mailing list?*
*A* : Send mail to the list address <djgpp@delorie.com> as if it were a
person. Please use the mailing list only if you cannot access the DJGPP news
group, because reflecting the mail to and from the mailing lists incurs
additional load on the DJGPP server.
File: djgppfaq.info, Node: Subscribing, Next: Unsubscribing, Prev: Mailing list, Up: Help
20.3 How to become a subscriber to the mailing list
===================================================
**Q*: How do I subscribe to the DJGPP mailing list?*
*A* : Send mail to the list server <listserv@delorie.com> (NOT to djgpp@!!),
leave the subject line empty and in the body write:
subscribe <your e-mail address> djgpp
If you only want to receive announcements of new versions and ported
software, but don't want to see any other DJGPP mail traffic, subscribe to
the `djgpp-announce' by sending message to the list server
<listserv@delorie.com> which says so:
subscribe <your e-mail address> djgpp-announce
The announcements which go to `djgpp-announce' get reflected to `djgpp', so
you don't have to subscribe to both these lists.
The DJGPP mailing list is available in the daily and weekly digest forms. To
subscribe to one of these, send this one-line message to the above list
server:
subscribe <your e-mail address> djgpp-digest-daily
subscribe <your e-mail address> djgpp-digest-weekly
Note that some mailers reject messages with too large size, so you might have
trouble with the weekly digest. If you subscribe to it and don't get the
digest, try the daily one instead, or switch to another mail software.
You can also subscribe to DJGPP-related mailing lists through DJ Delorie's
WWW server, at this URL:
http://www.delorie.com/mailing-lists/subscribe.html
Note that you don't have to subscribe to the djgpp mailing list if you don't
want to get all the traffic in your mailbox (typically, about 30 messages per
day). You can ask questions on the list even if you are not a subscriber,
because people usually answer both to your e-mail address and to the list
(well, actually, the mailer program does it automatically and most people
don't bother to change that). If you want to be sure the mail gets to you
directly, say in your message that you don't subscribe to the list, and ask
people to answer directly.
If you have a Usenet feed, consider reading the comp.os.msdos.djgpp news
group instead, so that the load on DJ's list server will get lower. There is
also a possibility of reading the news group (but not posting to it) through
the Mercury Gopher server at Michigan State University,
gopher://gopher.msu.edu:3441/chronological%20comp.os.msdos.djgpp
File: djgppfaq.info, Node: Unsubscribing, Next: Silent list, Prev: Subscribing, Up: Help
20.4 How to unsubscribe from the mailing list
=============================================
**Q*: Whew! There's too much traffic on the djgpp mailing list (at least the
SysAdmin glaring over my shoulder thinks so... ;-). How do I unsubscribe
myself?*
**Q*: I've been trying for days to unsubscribe from the djgpp mailing list.
What am I doing wrong?*
*A* : You should be sending your unsubscribe messages to the list server
<listserv@delorie.com> *(not djgpp@delorie.com!),* with the contents being
just this:
unsubscribe <your e-mail address> djgpp
When you unsubscribe, that stops *new* messages from being sent to you.
Messages that are already in the mail queues of various mail programs between
the DJGPP list server and the machine where you receive your mail--cannot be
stopped. Therefore, allow some time before you decide that your unsubscribe
message didn't work. In extreme cases, when one of the machines that are
forwarding mail to you is down, you can get the messages upto 5 days after
you've unsubscribed.
If you think you have waited enough and the messages still keep coming, write
to listserv administrator <djgpp-request@delorie.com> and ask him to help you.
You can also unsubscribe yourself from any of the DJGPP-related mailing lists
through DJ Delorie's WWW server, at this URL:
http://www.delorie.com/djgpp/mailing-lists/subscribe.html
Recently, DJ has added a mail archive browser to his Web site. With this
tool, you can list and read the messages by year, month and day, as well as
search the last few days for something you might have missed. This service
is available via World-Wide Web, at this URL:
http://www.delorie.com/djgpp/mail-archives/browse.cgi
File: djgppfaq.info, Node: Silent list, Next: Duplicates, Prev: Unsubscribing, Up: Help
20.5 If you don't see any message from the list ...
===================================================
**Q*: I don't get any messages from the DJGPP list for several days. Is the
list alive?*
*A* : Try sending a message to the list and see if you get it back. If not,
it is possible that your name was inadvertently taken off the list. This is
known to happen sometimes (don't ask me how). Also, if your address
consistently fails (like "user unknown" or "unknown host"), DJ Delorie
removes that address from the list, but cannot send a message to this effect,
for obvious reasons. You can check if you are subscribed to any of the
DJGPP-related mailing lists through DJ Delorie's WWW server, at this URL:
http://www.delorie.com/djgpp/mailing-lists/subscribe.html
If this tells you you're not, re-subscribe yourself by sending the above
subscription message to listserv <listserv@delorie.com>, or via DJ's server,
at this URL:
http://www.delorie.com/djgpp/mailing-lists/subscribe.html
When in doubt, re-subscribe anyway (it hurts neither you, nor the list
server).
If you subscribe to the weekly digest, then the problem might be that your
mailer rejects the huge message size. Try the daily digest, or switch to
another mailer, and see if that helps.
File: djgppfaq.info, Node: Duplicates, Next: Newsgroup, Prev: Silent list, Up: Help
20.6 Why do I get every message more than once?
===============================================
**Q*: Why am I getting 2 and often more copies of the same message? Don't
you people think I can get the idea at the first reading??*
*A* : First, check the headers to make sure that all of the duplicate
messages have their `To:' header addressed to the DJGPP list, not to your
direct e-mail address. Often, when people reply to your post, you get the
direct message, and a `Cc:' (the "carbon copy") one via djgpp list server.
This is normal behavior.
If indeed you get more than one copy of a message addressed to the list, it
is possible that you have added yourself to the list several times. (This
could happen if your site supports a mail exploder which re-mails DJGPP to
you, and you have also subscribed yourself directly.) One way to check this
would be to unsubscribe and see if you keep getting mail. Another way is to
check your subscription through DJ's server, at this URL:
http://www.delorie.com/djgpp/mailing-lists/subscribe.html
Look out for multiple subscriptions, possibly under different
names/addresses. You could also write to DJ Delorie <dj@delorie.com>, and
ask him to investigate.
Another thing to do, especially if you think it's not your fault, is to write
to a user named POSTMASTER at the address of each of the machines whose names
you find in the `Received:' headers of the bouncing messages (these are
people responsible for the operation of the mail software at their sites) and
ask them politely to help.
Many times this kind of problem is caused by excessive load on the list
server, so everybody who can please switch to reading the comp.os.msdos.djgpp
news group and unsubscribe from the list.
File: djgppfaq.info, Node: Newsgroup, Prev: Duplicates, Up: Help
20.7 DJGPP now has a news group!
================================
**Q*: With so much daily traffic (about 30 messages a day), isn't it high
time to create a Usenet News group?*
*A* : Beginning June 1st, 1995, DJGPP *has* its News group! It is called
*comp.os.msdos.djgpp*, and it is two-way gated to the venerable DJGPP mailing
list. This means messages posted to either the mailing list or the news
group will appear on both (once, let's hope ;-); you can read either one and
post to either one, and everyone eventually sees everything. The entire
traffic ends up in the mail archives on the DJ's Web server within 24 hours,
and is available for searching, at this URL:
http://www.delorie.com/djgpp/mail-archives/
If you have a Usenet feed, now is the time to consider unsubscribing from the
mailing list and switch to reading the news group instead, so that the load
on the list server will get lower.
File: djgppfaq.info, Node: v2, Next: Miscellany, Prev: Help, Up: Top
21. Version 2.0 vs v1.x
***********************
This chapter is for those who are used to working with DJGPP v1.x and want to
know more about v2.0 while they consider switching.
* Menu:
* New and improved:: What's new in v2.0?
* Environment:: How v2.0 environment is different from v1.
File: djgppfaq.info, Node: New and improved, Next: Environment, Prev: v2, Up: v2
21.1 New features in DJGPP v2.0
===============================
**Q*: What exciting new features will I find in v2.0 as opposed to v1.x?*
*A* : DJGPP v2.0 is a DPMI-only environment, and it includes a free DPMI
host for those who don't have another DPMI provider installed. In addition,
v2.0 features the following major improvements upon v1.1x:
* much faster extender (the free DPMI host) and library functions;
* very low memory footprint of the DPMI host below 640KB;
* the DPMI server is loaded only once: no more problems with spawning child
programs (e.g., almost unlimited recursive Make's);
* ANSI- and POSIX-compliant libraries and header files, which should make
porting Unix programs a lot easier;
* support for signals;
* 387 emulation under DPMI;
* graphics which works in *any* setup, including under Windows;
* fixes of many bugs in hardware interrupts' and mixed-mode programming
support;
* ability to build all of DJGPP without commercial products (like Turbo C
required to compile go32 in v1.x);
If you want to help in further v2 development, check out the list of features
which have yet to be done and volunteer to implement some of them.
File: djgppfaq.info, Node: Environment, Prev: New and improved, Up: v2
21.2 DJGPP environment in v2.0
==============================
**Q*: There's been this talk about v2 and about `go32' going away in that
version, but I'm confused on what the new setup will be. Could you clarify
the details of this change?*
*A* : In v1.x of DJGPP, the `go32' extender was responsible for the
following:
* Loading and running the application in protected mode.
* Managing protected-mode and virtual memory.
* "Extending DOS" so that protected-mode programs could issue calls to
real-mode DOS and BIOS services and still run. (This is mostly done by
switching to real mode and reissuing the interrupt, but some services
require special handling by the extender.)
* Handling of hardware interrupts which happen while the CPU is in
protected mode.
* Loading 387 emulator (if required).
* Loading the graphics driver and working with VGA bank-switching to create
an illusion of a linear video memory.
* Command-line and wild-card expansion in a Unix-like fashion.
In v2.x, most of these functions are done by a DPMI host, which is a
memory-resident software required to run protected-mode programs under
MS-DOS. There are a few commercial DPMI hosts (like Quarterdeck's `QDPMI',
Qualitas `386Max', MS-Windows 3.x and Win95, OS/2, even Linux), but DJGPP v2
comes with a free DPMI host called `CWSDPMI' for those who don't have one
already. Loading the application into protected-mode memory (a function done
in v1.x by `go32') is handled by a 2KB-long real-mode stub which runs at
start-up, before the application's `main' functions is called (the stub will
also load `CWSDPMI' if no other DPMI host is detected). All the other custom
code required to process BIOS- and DOS-related calls from protected-mode is
now built into the library functions which your program calls, so there is no
need for a special extender, because the application just issues DPMI calls
serviced by the DPMI host.
`CWSDPMI' can be loaded as a TSR, even loaded `HIGH' into the HMA/UMB, which
will make applications load much faster.
File: djgppfaq.info, Node: Miscellany, Next: About, Prev: v2, Up: Top
22. Miscellany
**************
This chapter is a hodgepodge of questions which don't belong to any of the
other chapters.
* Menu:
* Changing:: How to change any DJGPP package?
* Samples:: Where to find sample/ported code for DJGPP?
* Symlinks:: Yes, DJGPP allows them (well, almost...)
* DPMI Spec:: Where to look for DPMI specifications.
* WWW:: The DJGPP Web site.
* Upload:: Where to upload your DJGPP packages.
* Cross-DJGPP:: You can use DJGPP for cross-development.
* 0xfe+0x20:: Is this a bug?
* Struct size:: What is the size of a struct under DJGPP?
* Struct packing:: C++ compiler doesn't pack structs.
* Int 24h:: Catching those "Abort, Retry" messages.
* go32-v2:: What is go32-v2 for?
* DXE:: What are those `.dxe' files?
* LFN:: LFN support has some subtle bugs.
* Missing separator:: What does Make mean by that?
* Zoneinfo:: What's in that *zoneinfo/* directory?
* FAQ format:: How to convert this FAQ to other formats.
File: djgppfaq.info, Node: Changing, Next: Samples, Prev: Miscellany, Up: Miscellany
22.1 How to change a DJGPP package?
===================================
**Q*: I want to change cc1. How do I do this?*
**Q*: How do I fix a bug/add a feature to one of the DJGPP programs?*
*A* : First, get the sources. These are called `*s.zip' in the DJGPP
distribution. The C Library sources are in `djlsr200.zip'. Some sources are
too big, and might be split into multiple zips, all of which must be unzipped
to get a complete source distribution, like this:
`gcc263s1.zip'
`gcc263s2.zip'
`gcc263s3.zip'
`gcc263s4.zip'
`gcc263s5.zip'
`gcc263s6.zip'
All sources are shipped in ready-to-build form. Any diffs that come with the
source distribution, like the files in the `diffs/' directory, have already
been applied.
Next, try to build the program without changing it. Some packages will have
a `CONFIGUR.BAT' file; if so, run it first. If there is a `MAKE.BAT' file,
run it; if not, look for a file named `MAKEFILE.DJ' or `MAKEFILE.DJG';
sometimes these will be in a subdirectory called `dos/', or `msdos/', or
`pc/.' If there is such a file, then type, e.g., `make -f makefile.djg', if
not, just say `make' and see what happens. (The reason for an apparent lack
of a standard here is that different packages were ported to DJGPP by
different people, as best as they saw fit.) After you've successfully built
the program, make your fixes and build the program the same way you did
before.
Note that generally you must have the GNU `Make' program to build these
programs (get the file mak373b.zip, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/mak373b.zip), and some
makefiles require that you install additional utilities, like Sed (get
sed118b.zip, e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/sed118b.zip).
Sometimes the makefiles won't even run under `COMMAND.COM' (they require a
smarter shell). In that case, either get a better shell, convert the
makefile to be runnable by `COMMAND', or do the required steps manually. If
the Makefile is too complex for you and you can't figure out what are the
necessary commands, invoke make with `-n' switch and see what it would have
done.
If your machine lacks floating-point hardware (like a 386 without a 387, or a
486SX), then you should know that current versions of GNU Sed and GNU Make
issue floating point instructions, so you will have to make provisions for
loading an emulator, see above, *Note FP Emulation: Emulation.
If you think that you found a bug in one of the programs or libraries written
for DJGPP (e.g. the C library, CWSDPMI, symify, etc.) be sure to check the
list of known bugs, at this URL:
http://www.delorie.com/djgpp/doc/kb/kb_7.html#SEC4
If your bug is not there, you can later submit it to the bug-tracking system,
at this URL:
http://www.delorie.com/djgpp/bugs/
Before you submit a bug report, please make every effort to verify that your
bug is not caused by problems in your DJGPP installation. Reports such as
"All DJGPP programs crash" or "I cannot compile any program" are clearly not
bugs, because these things work for many hundreds of DJGPP users every day.
If you can investigate the cause of the bug and find a solution that makes it
go away, submit a bug report with all the details. If you cannot find the
cause(s), I suggest posting your problem description to the news group and
asking people to verify that it is indeed a bug, before you submit a bug
report.
File: djgppfaq.info, Node: Samples, Next: Symlinks, Prev: Changing, Up: Miscellany
22.2 Where to find sample DJGPP code or a package ported to DJGPP?
==================================================================
**Q*: Where can I find an example of XXXX / a package doing YYYY ?*
*A* : Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp> has compiled a list
of publicly available packages related to DJGPP, based on the DJGPP mailing
list traffic. The list is still under construction (Steve says that many
pointers have not been followed up to get host and directory references
right), so it must be taken with a grain of salt. Check out Steve's list, at
this URL:
http://turnbull.sk.tsukuba.ac.jp/public-ftp/djgpp/doc/documentation.list.html
Here is a list of places you might look into for examples of frequently
needed code fragments, or for packages people keep asking about:
* Interrupt-driven support of peripheral devices and hooking hardware
interrupts:
- Alaric B. Williams <alaric@abwillms.demon.co.uk> maintains a
library of utility functions and example handlers, useful for
writing hardware interrupt handling code. You can get Alaric's
library with your Web browser, at this URL:
http://www.abwillms.demon.co.uk/prog/libhw.zip
- Bill Currie <bill_currie@MAIL.TAIT.CO.NZ> has written sample code
for hardware interrupt handlers, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/sample-interrupt-handlers-v2.zip
which should get you off the ground if you need to write your own
handlers.
- Martynas Kunigelis <martynas.kunigelis@vm.ktu.lt> donated a
tutorial and a working code that installs a keyboard interrupt
handler, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/mkkbd3.zip that
can also serve as a good example of a hardware interrupt handler.
- you can look at the latest version of Sound Blaster support library
at the Oulu repository, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/sb05_dj2.zip or at
the DJGPP server, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/sb05_dj2.zip; this package
is maintained by Joel Hunter <jhunter@kendaco.telebyte.net>.
- check out the example of hooking the timer interrupt, e.g.
ftp://ftp.coast.net/Coast/msdos/c/pctime13.zip.
- if you need a serial communications library, check out SVAsync,
e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/svasync.zip.
* Network support libraries:
- the TCPLIB library, e.g.
ftp://lab1.psy.univie.ac.at/pub/tcplib-dj200/tcplib-dj200.1.tar.gz
provides the TCP/IP sockets interface. (I am told that you can
safely ignore the warnings you get when compiling the package.)
- a port of WATTCP library, e.g.
ftp://ftp.msen.com/pub/vendor/snsi/wattcp/gnu-c/.
* Port of curses library to DJGPP:
- download PDCurses package, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/pdc22.zip.
* X library:
- the Xlibemu library, e.g. ftp://asterix.inescn.pt/pub/PC/X/ includes
`Xt' and `Xmu' toolkits, a 3D version of the `AW' toolkit, a few
demo applications (e.g. `xmine'), and can be used to compile
`Tcl'/`Tk' and GNU Emacs with X support. Xlibemu is based on X11R5
and was developed by Antonio Costa <acc@asterix.inescn.pt> for
DJGPP v1.x. It is also available on an alternative site, e.g.
ftp://groucho.idt-isep.ipp.pt/pub/pc/djgpp/etc/X/ and on the DJGPP
server, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/Xlibemu/.
- the Xlib and Xt for DV/X environment, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v1tk/qddvx102.zip (you
will also need qdlib102.zip and qdtkt102.zip from the same site).
* Ports of various GNU utilities not included in DJGPP (like Fileutils,
Grep, Less, etc.):
- Look on SimTel mirrors in the GNUish, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/gnuish/dos_only/ and
Textutil, e.g. ftp://ftp.simtel.net/pub/simtelnet/msdos/textutil/
directories. These are 16-bit ports.
- Marc Singer <elf@netcom.com> maintains a port of RCS, the Revision
Control System, to DJGPP, e.g.
ftp://ftp.netcom.com/pub/el/elf/rcsdos/.
* Development environments:
- Try the RHIDE system by Robert Hoehne
<Robert.Hoehne@Mathematik.TU-Chemnitz.DE>. RHIDE is in the last
stages of beta-testing and is available via WWW, at this URL:
http://www.tu-chemnitz.de/~rho/rhide.html
and also from the DJGPP disribution sites, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2apps/
- If you want the ultimate editing power, you might as well go for the
best, which is of course the one-and-only GNU Emacs! The latest
version of Emacs is available from the GNU ftp sites, e.g.
ftp://ftp.gnu.ai.mit.edu/pub/gnu/emacs-19.34b.tar.gz and will
compile out of the box with DJGPP v2. The DJGPP version supports
menus, mouse, color syntax highlighting and many Emacs packages
(like `ps-print' and `ediff') that previously didn't work on
MS-DOS. On Windows 95, Emacs compiled with DJGPP supports long
filenames.
* GUI libraries:
- SWORD (the System of Windows for the ORganization of the Desktop)
is a Graphic User Interface library made with C++ objects, written
and maintained by Eric Nicolas <nicolas@JUPITER.saclay.cea.fr>. The
latest version 2.1 is available from the DJGPP v2tk subdirectory,
e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/ as
sw21_*.zip.
- check out the BCGUI package, at this URL:
http://www.delorie.com/djgpp/dl/contrib/
or get BCGUI via FTP, e.g.
ftp://ftp.delorie.com/pub/djgpp/contrib/bcguiNNN.zip or get BCGUI
at Stephen Turnbull's server, e.g.
ftp://turnbull.sk.tsukuba.ac.jp/pub/djgpp/packages/bcguiNNN.zip.
- If you actually have the original Borland Turbo Vision, then you
might want to get patches to compile Turbo Vision under DJGPP, e.g.
ftp://ftp.uni-stuttgart.de/pub/systems/os2/programming/support/.
For more info on this port, visit the TVPlus site, at this URL:
http://www.zeta.org.au/~grove/tvhome.html
- Another port of Turbo Vision library was done by Robert Hoehne
<Robert.Hoehne@Mathematik.TU-Chemnitz.DE>, and can be downloaded
via WWW, at this URL:
http://www.tu-chemnitz.de/~rho/tvision.html
, and also from the DJGPP distribution sites, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/tvisionb.zip
* Game programming:
- Try the Jlib gaming/graphics library, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/jlib_NNN.zip
written by J P Griffiths <jpg@cs.waikato.ac.nz>.
- Also see the Allegro game programming library, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/alleg21.zip,
written by Shawn Hargreaves <slh100@mailer.york.ac.uk>. It is also
available from the DJGPP archives, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/alleg21.zip.
* VGA Mode-X graphics:
- Paul Fenwick <bg914@FreeNet.Carleton.CA> wrote an X-Mode package
Xlib, e.g. ftp://ftp.delorie.com/pub/djgpp/contrib/xlibdj24.zip or
Xlib at Oulu, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/djgpp2/xlibdj24.zip.
File: djgppfaq.info, Node: Symlinks, Next: DPMI Spec, Prev: Samples, Up: Miscellany
22.3 How to create symbolic links to programs
=============================================
**Q*: How do I create symbolic links?*
**Q*: I have this program that behaves differently depending on the name it's
called. Under Unix, I just create symbolic links to achieve that, but DOS
doesn't support links. Do I have to put several identical programs under
different names on my disk??*
*A* : DJGPP allows you to simulate symbolic links to programs. Generate a
stub (which is a small DOS program attached to every DJGPP program by the
`stubify.exe' program), call it by the name of the link you want, then edit
its header to run another program. For example, let's say the real program
is `dj1.exe' and we want to make a link called `dj2.exe' that really calls
`dj1.exe.' First, generate a stub under the name `dj2.exe.' Next, run
`STUBEDIT' to modify the new program's stub info block and change the name of
the executable it runs. In this case, we'd change it to `dj1':
C:\USR\BIN> stubify -g dj2.exe
C:\USR\BIN> stubedit dj2.exe runfile=dj1
Voila! Now, when you run `dj2', it tells the stub to load the image of
`dj1', but pass "dj2" in `argv[0].'
File: djgppfaq.info, Node: DPMI Spec, Next: WWW, Prev: Symlinks, Up: Miscellany
22.4 Where to find the DPMI specification?
==========================================
**Q*: Where can I find the specifications for the DPMI functions?*
*A* : You can find the DPMI 0.9 spec by anonymous ftp to one of the
following sites:
At the Quarterdeck ftp site, e.g. ftp://qdeck.com/pub/memory/dpmispec.zip.
At the Oulu repository of PC-specific programming info, e.g.
ftp://x2ftp.oulu.fi/pub/msdos/programming/specs/dpmispec.arj.
The DPMI 1.0 specs are available by anonymous ftp from the Intel anonymous
ftp site, e.g. ftp://ftp.intel.com/pub/IAL/software_specs/dpmiv1.txt. (The
file `dpmip1.zip' at the same location is the PostScript version of this
spec.)
Some information about the DPMI API is also found in the Ralf Brown's
Interrupt List, e.g.
ftp://ftp.simtel.net/pub/simtelnet/msdos/info/inter50c.zip. Look at the
functions of Interrupt 31h, or search the files for the word `DPMI.'
You can also browse the DPMI spec on-line, at this URL:
http://www.delorie.com/djgpp/doc/dpmi/
File: djgppfaq.info, Node: WWW, Next: Upload, Prev: DPMI Spec, Up: Miscellany
22.5 The DJGPP Web site.
========================
**Q*: Where is the DJGPP Web site?*
*A* : Yes, DJGPP has its own home on the Internet, set up and maintained by
(who else?) DJ Delorie <dj@delorie.com>. It has an HTML version of this FAQ
list with search capabilities, the entire set of DJGPP distribution files, a
searchable archive of the DJGPP mailing list and news group traffic, plus
other useful and interesting information about DJGPP. For instance, did you
ever wonder how DJGPP got started and what DJ's original goals were?
Rejoice: the Web site includes the story of DJGPP genesis, at this URL:
http://www.delorie.com/djgpp/history.html
To visit, point your Web browser to the DJGPP Web site, at this URL:
http://www.delorie.com/djgpp/
File: djgppfaq.info, Node: Upload, Next: Cross-DJGPP, Prev: WWW, Up: Miscellany
22.6 Where to upload your contributions to DJGPP
================================================
**Q*: I wrote a program using DJGPP. How can I make it available to others?*
**Q*: I found and corrected a bug in one of the programs distributed with
DJGPP. Where should I put it?*
*A* : If the program/patches are small enough, consider posting it to the
mailing list or the comp.os.msdos.djgpp news group as uuencoded compressed
archive (to conserve space).
If the compressed file is larger than, say, 50K bytes, it's best to upload it
to a public site where everybody can get it. You can upload your
contribution to a special directory on the DJ Delorie's FTP server, e.g.
ftp://ftp.delorie.com/incoming/. This directory is write-only, and it gets
purged every couple of days, so be sure to write to DJ Delorie
<dj@delorie.com> about your upload; he will then move it to the
`/pub/djgpp/contrib' directory. (There used to be another place, a directory
on `omnigate.clarkson.edu' which was writable by anonymous, but it was being
used for malicious purposes and the sysadmins there decided to close it :-(.)
If you decide to upload, please send mail to the `djgpp-announce' list with a
brief description of your program/patch. (The message will get reflected to
both the news group and the DJGPP mailing list, so you don't have to
cross-post there, but it also goes to people who only subscribe to
djgpp-announce list because they want to get such announcements and nothing
else.)
If your program is more than a patch or a beta version, you might consider
uploading it to the DJGPP archives on SimTel. If you decide to do it, write
to DJ Delorie <dj@delorie.com> and ask him for uploading instructions.
Material uploaded there gets automatically distributed to all of the SimTel
mirrors throughout the world, which makes it easier to get.
DJ Delorie requests that all contributed packages uploaded to his server be
source-only distributions; don't bother to include libraries or pre-compiled
binaries, since DJ deletes them when he opens the zip archive. This is so
there will be no danger of distributing programs infected by a virus (as
there are no 32-bit virus-scanners yet). Please avoid uploading
self-extracting archives because DJ extracts them on a Unix machine which
can't run DOS executables.
File: djgppfaq.info, Node: Cross-DJGPP, Next: 0xfe+0x20, Prev: Upload, Up: Miscellany
22.7 DJGPP as cross-compiler
============================
**Q*: I want to use DJGPP as a cross-compiler for Motorola 68K targets. How
should I proceed about this?*
**Q*: I want to build GCC as a Unix-to-DOS cross-compiler. What should I do?*
*A* : If you want a cross-compiler for m68k on a DOS machine, you need is
DJGPP configured as `host=i386-go32', and `target=m68k-coff.' This has been
done already, e.g. ftp://ftp.lysator.liu.se/pub/msdos/gnu/gcc-dos-m68k/. The
binaries there are based on GCC 2.6.0. This package is reportedly no longer
supported, but if you have questions about it, you can send them to Jim
Karpinski <jk55@cornell.edu>.
For building GCC as a Unix-to-DOS cross-compiler, here are the instructions
on how to do it. (Unfortunately, "make install" in the Gcc distribution does
exactly the wrong thing by default, so you end up copying a lot of stuff
around manually.)
First, use the original FSF distributions for Gcc and Binutils, not the
source distributions from DJGPP. That's because the DJGPP archives have
sources patched to compile on MS-DOS and sometimes omit files that aren't
necessary for DJGPP. In particular the GCC sources lack many files that the
MS-DOS build doesn't need.
Unpack Gcc and Binutils into a directory, let's call it `X/.' Thus, you
have, say, `X/gcc-2.7.0' and `X/binutils-2.5.2.' The following sequence of
commands should make the job:
mkdir X/dos-binutils
cd X/dos-binutils
configure --target=i386-coff-go32
make CFLAGS=-O
mkdir -p /usr/local/i386-go32-msdos/bin
cd binutils
cp ar c++filt objcopy objdump size /usr/local/i386-go32-msdos/bin
cp nm.new /usr/local/i386-go32-msdos/bin/nm
cp strip.new /usr/local/i386-go32-msdos/bin/strip
cd ../gas
cp as.new /usr/local/i386-go32-msdos/bin/as
cp gasp.new /usr/local/i386-go32-msdos/bin/gasp
cd ../ld
cp ld.new /usr/local/i386-go32-msdos/bin/ld
cd ../../..
mkdir X/dos-gcc
cd X/dos-gcc
configure --target=i386-go32-msdos
# Note: this produces errors building libgcc.a. Ignore them.
# The libraries will come from the cross-compiler kit.
make LANGUAGES=c CFLAGS=-O
cp xgcc /usr/local/bin/gcc-dos
cp cc1 /usr/local/i386-go32-msdos/bin/cc1
cp cccp /usr/local/i386-go32-msdos/bin/cpp
Unzip the DJDev and Gcc distributions in, say, /usr/local/djgpp. Ideally,
build libgcc.a on a DOS machine, or get it from the `djcrx200.zip' archive.
Remove all `^M' characters from include files (you can compile DTOU.c on the
Unix box to make this easier). Alternatively, use the `-a' switch to UnZip
when unzipping the archives.
Change lib/djgpp.lnk to use "coff-i386" instead of "coff-go32" and remove the
`^M' characters from that file also.
mkdir -p /usr/local/lib/gcc-lib/i386-go32-msdos/2.7.0
cd /usr/local/lib/gcc-lib/i386-go32-msdos/2.7.0
ln -s /usr/local/djgpp/include .
ln -s /usr/local/djgpp/lib/* .
Build `stubify' and install it in `/usr/local/i386-go32-msdos/bin.' You
might need to insert these two lines at the beginning of `stubify.c':
`#include <sys/types.h>'
`#include <unistd.h>'
That's it! To build a program for DOS, say something like this:
gcc-dos hello.c -o hello.exe
File: djgppfaq.info, Node: 0xfe+0x20, Next: Struct size, Prev: Cross-DJGPP, Up: Miscellany
22.8 GCC says "garbage at end of number"
========================================
**Q*: There is a severe bug in GCC: it says "garbage at end of number" for
this line:*
i = 0xfe+0x20;
*Ain't it silly that such a great compiler would fail so miserably?*
*A* : That's not a bug, that's a feature of the *ANSI C language
definition.* By ANSI rules, the above expression is a single "preprocessing
token", unless you place whitespace in front of the plus sign. The reason
for this seemingly counterintuitive feature is the syntax of floating-point
constants in which letters `e' and `E' followed immediately by a sign signal
a decimal exponent. You can use the `-traditional' compiler switch to turn
this feature off (together with a plethora of other ANSI features; see the
GCC docs for details).
File: djgppfaq.info, Node: Struct size, Next: Struct packing, Prev: 0xfe+0x20, Up: Miscellany
22.9 What should sizeof (struct xyzzy) return?
==============================================
**Q*: When I call `sizeof' on a struct, I sometimes get values which are
larger than the sum of the sizes of the struct fields, whereas in Borland C++
I always get the correct result. Is it a bug in GCC?*
**Q*: I have a program that reads struct contents from a binary file. It
works OK when compiled with BC, but reads garbage when compiled with DJGPP.
This must be a bug in DJGPP, right?*
*A* : No, it's not a bug. GCC generates 32-bit code, and in that mode, there
is a significant penalty (in terms of run-time performance) for unaligned
accesses, like accessing a 16-bit short which isn't aligned on a word
boundary, or accessing a 32-bit int which isn't aligned on a dword boundary.
To produce faster code, GCC pads struct fields so that each field can be
accessed without delays; this sometimes produces struct size which is larger
than the sum of the sizes of its fields. If you need to minimize this
padding (e.g., if your program uses large arrays of such structs, where
padding will waste a lot of memory), lay out your structures so that the
longer fields are before the shorter ones. For example, let's say that you
have a struct defined thus:
struct my_struct {
char name[7];
unsigned long offset;
double quality;
};
To make such a struct use the least number of bytes, rearrange the fields,
like this:(1) (*note Struct size-Footnotes::)
struct my_struct {
double quality;
unsigned long offset;
char name[7];
};
If the layout of the structure cannot be changed (e.g., when it must match
some external specification, like a block of data returned by some system
call), you can use the `__attribute__((packed))' extension of GCC (*Note the
Gcc docs: (gcc)Type Attributes.) to prevent GCC from padding the structure
fields; this will make accesses to some of the fields slower.
Beginning from version 2.7.0, GCC has a command-line option `-fpack-struct'
which causes GCC to pack all members of all structs together without any
holes, just as if you used `__attribute__((packed))' on every struct
declaration in the source file you compile with that switch. If you use this
switch, be sure that source files which you compile with it don't use *any*
of the structures defined by library functions, or you will get some fields
garbled (because the library functions weren't compiled with that switch).
The padding of struct fields should be considered when you read or write
struct content from or to a disk file. In general, this should only be done
if the file is read and written by the same program, because the exact layout
of the struct fields depends on some subtle aspects of code generation and
the compiler switches used, and these may differ between programs, even if
they were compiled by the same compiler on the same system. If you do need
this method, be aware of the struct field padding and don't assume that the
number of the file bytes that the structure uses is equal to the sum of the
fields' sizes, even if you instructed the compiler to pack structs: GCC still
can add some padding after the last field. So always use `sizeof struct foo'
to read and write a structure.
Another problem with porting programs that read structs from binary files is
that the size of some data types might be different under different
compilers. Specifically, an `int' is 16-bit wide in most DOS-based
compilers, but in DJGPP it's 32-bit wide.
The best, most robust and portable way to read and write structs is through a
`char' buffer, which your code then uses to move the contents into or out of
the struct fields, one by one. This way, you always know what you are doing
and your program will not break down if the padding rules change one day, or
if you port it to another OS/compiler.
File: djgppfaq.info, Node: Struct size-Footnotes, Up: Struct size
(1) Note that this still allows the struct to be padded at the end, though.
File: djgppfaq.info, Node: Struct packing, Next: Int 24h, Prev: Struct size, Up: Miscellany
22.10 C++ doesn't pack structs!
===============================
**Q*: When I use `struct ffblk' from the header `dir.h' in a C++ program, I
get garbage in some fields of the structure!*
*A* : There is a known bug in GCC 2.7.2: the C++ compiler effectively
ignores the `__attribute__((packed))' directives, so the structures end up
being not packed. As a work-around, surround the declaration of the
structure that needs to be packed with `#pragma pack', like this:
#ifdef __cplusplus
#pragma pack(1)
#endif
.
.
.
#ifdef __cplusplus
#pragma pack()
#endif
File: djgppfaq.info, Node: Int 24h, Next: go32-v2, Prev: Struct packing, Up: Miscellany
22.11 How to avoid "Abort, Retry, Fail" messages
================================================
**Q*: How do I write a program that accesses floppy and CD-ROM drives, but
avoids popping that "Abort, Retry, Fail?" message from DOS?*
**Q*: Other DOS compilers supply a function named `harderr' or `_harderr' to
hook the critical-error interrupt 24h, but DJGPP doesn't seem to have
these...*
*A* : Under DPMI, Int 24h is always hooked by the DPMI server, since Int 24h
is issued by the real-mode DOS code, and it is not possible to terminate a
DPMI client (like DJGPP program) from real mode, if you press `A' in response
to that prompt. The default handler under most DPMI servers will just set
`AL' register to 3 and `IRET', thus silently failing the DOS call that
triggered Int 24h. The DJGPP startup code also hooks the protected-mode Int
24h with a handler that fails the DOS call as described above. So in most
circumstances you won't see that DOS prompt at all; your program will just
see a failed DOS call.
However, some DPMI hosts (notably, QDPMI), will sometimes crash your program
if it generates Int 24h, for instance when you access an empty floppy drive.
In such cases, or when the default action of failing the DOS call is not good
enough, you will have to hook Int 24h with your handler. This should be done
in exactly the same manner as hooking hardware interrupts (*note how to set
an interrupt handler: Hardware interrupts.), because Int 24h is one of the
few software interrupts that, like all hardware interrupts, are always
reflected to the protected-mode handler first. Note that `CWSDPMI' currently
doesn't support hooking Int 24h; if you set an interrupt handler, it won't be
called.
There are ways to avoid program crashes due to Int 24h (under those DPMI
hosts that exhibit this buggy behavior) other than to install a handler for
it. For instance, you can test if the floppy drive is empty with a BIOS call
before accessing it with DOS functions; there are also similar ways to check
if a CD-ROM drive is empty. The library function `getmntent' (*Note
getmntent: (libc.inf)getmntent.) can be used to detect all the drives that
can be safely accessed by DOS; or you can borrow some of the internal
functions used by `getmntent' from the library source distribution, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djlsr200.zip.
File: djgppfaq.info, Node: go32-v2, Next: DXE, Prev: Int 24h, Up: Miscellany
22.12 What is that `go32-v2.exe' program?
=========================================
**Q*: What is go32-v2 for?*
*A* : The `go32-v2' program does the following:
* With no command-line arguments, it prints the available physical and
virtual memory, much like `go32' did in v1.x.
* It can run unstubified v2 COFF images, like this:
go32-v2 myprog
* If you rename it to `go32.exe' and put on your `PATH' before the v1.x
`go32.exe', it can also run a v1 COFF images, by loading the v1.x `go32'
and letting it do the job. With this setup, you can run v2 programs
from v1.x programs, because the v1.x program will load `go32-v2' (since
it found it first on the PATH) which knows how to run v2 images, instead
the original `go32' which cannot.
File: djgppfaq.info, Node: DXE, Next: LFN, Prev: go32-v2, Up: Miscellany
22.13 What is DXE?
==================
**Q*: What is DXE?*
**Q*: Can I make a DLL using the DXE support?*
**Q*: Where can I find information or examples about writing/loading the DXE
files?*
*A* : DXE is a limited facility to dynamically load code which is rarely
needed in DJGPP. An example is the floating-point emulator code (*note the
details of DJGPP FP emulator: Emulation.) which is only used on those few
machines that lack an FPU. The DXE design is intentionally limited to keep
it as simple as possible, so that the code that loads a DXE could be small
(it's a few hundreds bytes). Because of this, there are a number of
limitations in the DXE mechanism that prevent using it for full-fledged
dynamic linking (i.e., a DLL). For instance, the DXE module cannot access
variables or functions in the main module. Unloading a DXE is also not
supported (but I'm told you can add this by making simple changes in the C
library).
The only place you can find some docs and examples of writing and using a DXE
is in the file `djtst200.zip' in the DJGPP "tests" distribution, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/djtst200.zip. The example
there is *exceedingly* simplistic, but then so is the entire DXE mechanism...
File: djgppfaq.info, Node: LFN, Next: Missing separator, Prev: DXE, Up: Miscellany
22.14 Long Filenames Don't Work!
================================
**Q*: I cannot make Info find some of its files under Win95...*
**Q*: Why does Make behave as if some of the files were not there?*
*A* : Are you running DJGPP under Win95 with long filename support enabled
(LFN=y in the environment)? If so, set LFN=n from the DOS prompt and try
again. If the problems go away, they are probably due to known bugs in some
DJGPP programs wrt the LFN support. Make and Info are two programs which are
known to reveal these bugs. Before you decide that you are a victim of these
bugs, though, make sure that all the files that your programs need to access
have been renamed to their long names. For example, if Make needs to find a
file called `ALongFileName.cc' (because the Makefile tells it to build
`ALongFileName.o'), make sure there indeed is such a file in the directory.
Many times people use archive tools (like `PKZIP') that truncate long names,
even on Win95, when they open an archive, which leaves you with names like
`alongfil.cc', which is not the same as the original name when LFN is
supported. Be sure to use archivers that support long filenames, e.g. use
`DJTAR' when you open `.tar.gz' archives, or rename all the files to their
original long names after you open the archive.
If the problems persist even though the filenames are correct, you will have
to disable LFN support (set LFN=n from the DOS prompt, setting it in
`DJGPP.ENV' does not always works) until these problems are fixed in some
future version of DJGPP.
File: djgppfaq.info, Node: Missing separator, Next: Zoneinfo, Prev: LFN, Up: Miscellany
22.15 Make says "missing separator"
===================================
**Q*: When I invoke Make, it refuses to do anything and prints this cryptic
message:*
makefile:10: *** missing separator. Stop.
*Now what kind of excuse is that?*
*A* : Unlike most other DOS Make programs which accept any whitespace
character at the beginning of a command in a rule, GNU Make insists that
every such line begins with a TAB. (Most other Unix Make programs also
require TABs.) Make sure that the line whose number is printed in the error
message (in this case, line 10) begins with a TAB.
There are editors that replace TABs with spaces, so even a Makefile that used
to work can become unworkable if you edit them with such an editor.
Another, more rare, cause of the above error message is if you use static
pattern rules (with the `%' character) incorrectly. Read the documentation
that comes with Make carefully and try to find the error.
File: djgppfaq.info, Node: Zoneinfo, Next: FAQ format, Prev: Missing separator, Up: Miscellany
22.16 What is in that `zoneinfo' directory?
===========================================
**Q*: When I installed DJGPP v2, it created a directory named `zoneinfo' with
a lot of small files that take up 3.5MB of my disk space. What are they for?
Can I delete them?*
*A* : These files exist so that time-related library functions can correctly
calculate the offset between the local time and the "UTC" (Universal
Coordinated Time). This offset is required when you get files from another
time-zone, like from the Internet, or when you download an archive that was
compressed in another time-zone. If you don't care about file time stamps
being incorrect in such cases, you can delete all those files and never look
back.
You might wonder why we need all these zoneinfo files when the UTC offset
*is* required. Well, the simplest way to tell programs what the UTC offset
is, is to have the user specify a single number which is the offset; but then
this number needs to be changed twice a year, to accommodate for the daylight
saving time. Another, not-quite-so-simple way is to have the user specify
the current UTC offset and the DST rules; but this is a tedious and
error-prone process, and many users get it wrong. Both of these methods have
the drawback that if the rules change, programs misinterpret old time-stamps,
since they treat them according to new rules. Using a table that is read from
a file and includes the offset calculation rules for every year avoids all
these problems and requires the user to point the `TZ' environment variable
to the file that is pertinent to his/her time zone, which is easy:
set TZ=c:/djgpp/zoneinfo/israel
set TZ=c:/djgpp/zoneinfo/us/alaska
To find the rule suitable for your location, look into the `src' subdirectory
of `zoneinfo' and browse the file whose name is your continent/part of the
world. If no binary file exists with the name of your zone, you can create
one with using the time-zone compiler `zic', whose source is also in the
`src' subdirectory.
A public domain time-zone database exists, and is updated from time to time
with the latest world-wide changes to the offset calculation rules. (The
rules change because politicians in different countries make laws that change
the local clock settings.) The contents of the `zoneinfo' directory which
comes with DJGPP is based on this database, but if you want the latest rules,
you can download them from the net, e.g. ftp://elsie.nci.nih.gov/pub/ as
`tzdata*.tar.gz'; `tzcode*.tar.gz' in the same directory includes the
programs that can be used to generate the offset tables from their source in
`tzdata*.tar.gz', the latest implementations of POSIX library functions that
use time-zone information, and the man pages that document the rules and the
software. The last update as of this writing was in May 1996.
On any single machine, you don't need more than a single file from that
directory, which is the file for your time zone; once you find that file, you
can safely delete the rest. But if you distribute a program that uses the TZ
setting, you will have to include all of the files, or tell your users how to
get and install them.
File: djgppfaq.info, Node: FAQ format, Prev: Zoneinfo, Up: Miscellany
22.17 Generating the FAQ in your favorite format
================================================
**Q*: How can I generate the FAQ list in a format I'm used to?*
*A* : First, you need to get the FAQ sources. The sources of the latest
version of this FAQ list can always be found as `faq202s.zip' on DJ Delorie's
server, e.g. ftp://ftp.delorie.com/pub/djgpp/v2faq/faq202s.zip and on SimTel
mirrors, e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq202s.zip.
This includes the source file (written in Texinfo), and all the auxiliary
tools required to produce the Info, plain-ASCII, HTML, and a few other
versions of the FAQ list; the FAQ in all these formats is available in a
separate ZIP archive as `faq202b.zip' from DJ Delorie's server, e.g.
ftp://ftp.delorie.com/pub/djgpp/v2faq/faq202b.zip or from SimTel mirrors,
e.g. ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/faq202b.zip. Currently,
this includes the Info version, the text (ASCII) version and an HTML version
as a single large `.html' file. More formats will be available as the tools
for their generation are developed/tested.
If none of these formats is good enough for you, here are some tools
available to generate the FAQ list in other formats. If you know about any
format not mentioned below that can be generated using widely available
tools, please drop me a note so I could update this list and consider that
format or those tools for inclusion in a future release of the FAQ. If you
develop any such tools, consider uploading them to a site where they will be
publicly available, and tell me about that site.
Note that the FAQ source is a heavy user of the Texinfo macro facility, so
any conversion program that doesn't support Texinfo macros will probably have
hard time coping with the FAQ. When confronted with this problem try feeding
the converter with the macro-expanded version of the FAQ (the Makefile in the
source distribution has a special target for such cases).
A program called `Makertf' can reportedly be used to convert a Texinfo
sources of this FAQ to the "Rich File Format" which can then either be
browsed by an RTF browser (such as Adobe Acrobat) or converted into a Windows
Help file with a Windows Help compiler. `Makertf' is available from CCT
mirrors, e.g. ftp://ftp.coast.net/Coast/win3/winhelp/mkrtf104.zip. The
Windows Help Compiler is available via anonymous ftp from the Microsoft ftp
site, e.g. ftp://ftp.microsoft.com/Softlib/MSFILES/HC305.EXE.
There also a program called `INFNG' that can be used to convert the Info
(*not* Texinfo) version of the FAQ to the Norton Guide format. `INFNG' can
be downloaded from the DJGPP archive, e.g.
ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2misc/infng100.zip.
File: djgppfaq.info, Node: About, Next: Topic Index, Prev: Miscellany, Up: Top
23. About this FAQ
******************
Maintainer: Eli Zaretskii <eliz@is.elta.co.il>.
This FAQ is Copyright (C) 1994, 1995, 1996 by Eli Zaretskii
<eliz@is.elta.co.il>. It may be freely redistributed with the DJGPP package
or any part thereof, provided that you don't prevent anybody else from
redistributing it on the same terms, and that this copyright notice is left
intact.
Comments about, suggestions for, or corrections to this FAQ list are welcome.
Please make sure to include in your mail the version number of the document
to which your comments apply (you can find the version at the beginning of
this FAQ list).
Much of the info in this FAQ list was taken from the DJGPP mailing list/news
group traffic, so many of you have (unbeknownst to you) contributed to this
list. The following people read this list in its previous versions and
provided useful feedback, comments, information and/or suggestions:
John M. Aldrich <fighteer@cs.com>
Anthony Appleyard <A.APPLEYARD@fs2.mt.umist.ac.uk>
John Bodfish <bodfish@austen.notis.com>
Bill Davidson <bdavidson@ra.isisnet.com>
Francois Charton <deef@pobox.oleane.com>
Bill Currie <bill_currie@MAIL.TAIT.CO.NZ>
DJ Delorie <dj@delorie.com>
Juergen Erhard <jae@laden.ilk.de>
Jeremy Filliben <prime@UDel.Edu>
James W. Haefner <Jim@anolis.bnr.usu.edu>
Koen Van Herck <kvhk@barco.com>
Robert Hoehne <Robert.Hoehne@Mathematik.TU-Chemnitz.DE>
Gordon Hogenson <ghogenso@u.washington.edu>
Harry Johnston <omega@es.co.nz>
Martynas Kunigelis <martynas.kunigelis@vm.ktu.lt>
Pieter Kunst <kunst@prl.philips.nl>
Y. Lazarovitch <yitzg@haven.ios.com>
Alexander Lehmann <lehmann@mathematik.th-darmstadt.de>
Marty Leisner <leisner@sdsp.mc.xerox.com>
Dave Love <d.love@dl.ac.uk>
Rob Nader <naderr@topaz.cqu.edu.au>
Eric Nicolas <nicolas@JUPITER.saclay.cea.fr>
Elliott Oti <e.oti@stud.warande.ruu.nl>
Esa A E Peuha <peuha@cc.helsinki.fi>
Walter Prins <prins@quark.cs.sun.ac.za>
Steve Salter <salters@admin.fanshawec.on.ca>
Charles Sandmann <sandmann@clio.rice.edu>
Terrel Shumway <Shumw001@Cerritos.edu>
Andrew Szymkowiak <aes@solia.gsfc.nasa.gov>
Launey Thomas <ljt@sierrasemi.com>
Chris Tilbury <C.J.Tilbury@estate.warwick.ac.uk>
Stephen Turnbull <turnbull@shako.sk.tsukuba.ac.jp>
Santiago Vila <sanvila@pizarro.unex.es>
Ronan Waide <waider@waider.ie>
Morten Welinder <terra@diku.dk>
Anthony Edward Wesley <awesley@galaxy.anutech.com.au>
Mark H. Wood <mwood@mhw.OIT.IUPUI.EDU>
File: djgppfaq.info, Node: Topic Index, Next: Program Index, Prev: About, Up: Top
24. Topic Index
***************
This is an alphabetical list of all the topics covered in this FAQ. Use it
to search for a description of your problem and follow the link to find the
answer(s).
* Menu:
* !proxy method of passing long command lines: Long commands.
* "Far" declarations, porting to DJGPP: NEAR and FAR.
* "Huge" declarations, porting to DJGPP: NEAR and FAR.
* "Near" declarations, porting to DJGPP: NEAR and FAR.
* -ansi switch and C++-style comments in C programs: C++ comments.
* -fconserve-space switch: Large image.
* -fstrength-reduce optimization, disabled by default: Faster v1.
* -msoft-float switch to GCC: -msoft-float.
* -traditional switch and C++-style comments in C programs: C++ comments.
* .lib libraries, using with GCC: OBJ and LIB.
* .obj object files, using with GCC: OBJ and LIB.
* 16-bit code, using with DJGPP: 16-bit code.
* 68K targets, cross-compiling with DJGPP: Cross-DJGPP.
* @ character, how to pass it to programs: Special chars.
* ^Z character at end of DJGPP.ENV: Buggy DPMI.
* __crt0_glob_function, disable filename globbing: Disable globbing.
* __DJGPP__ pre-processor symbol: DJGPP-specific.
* __dpmi_get_memory_information, doesn't change after free/malloc: Confusing alloc.
* __dpmi_get_protected_mode_interrupt_vector: Hardware interrupts.
* __dpmi_get_real_mode_interrupt_vector: Hardware interrupts.
* __dpmi_int, calling DOS/BIOS services: int86.
* __dpmi_int, high in program's profile: I/O bound programs.
* __dpmi_int, how to pass buffers: Pointer segment.
* __dpmi_int, use to invoke software interrupts: Zero SP.
* __dpmi_simulate_real_mode_interrupt, need zero SS, SP and FLAGS: Zero SP.
* __dpmi_YYY vs _go32_XXX, which one to use: _go32 vs __dpmi.
* __GO32__ pre-processor symbol: DJGPP-specific.
* __pure_virtual, unresolved function: Pure virtual.
* __tb, an alias for the address of transfer buffer: Pointer segment.
* _go32_dpmi_allocate_iret_wrapper: Hardware interrupts.
* _go32_dpmi_chain_protected_mode_interrupt_vector: Hardware interrupts.
* _go32_remaining_physical_memory, doesn't change after free/malloc: Confusing alloc.
* _go32_XXX vs __dpmi_YYY, which one to use: _go32 vs __dpmi.
* _stklen, setting stack size: Stack size.
* Accessing absolute addresses above 1MB: Above 1MB.
* Accessing absolute addresses in conventional memory: Xfer.
* Accessing C variables from inline assembly: Inline Asm.
* Accessing VBE 2.0 linear frame buffer: Direct access.
* Accessing video memory: Direct access.
* Alignment of data by GAS can slow-down code: Pentium.
* Announcements, mailing list: Subscribing.
* Archives, DJGPP mailing list/News group, how to search: Deja vu.
* argv[0] when program runs under a debugger: How to debug.
* Asking for help: Totally lost.
* Assembly source, code produced by Gas: Gas bugs.
* Assembly source, converting to AT&T syntax: Converting ASM.
* Assembly source, converting to protected mode: ASM GPF.
* Assembly source, GCC/Gas syntax: Syntax.
* Assembly syntax: Syntax.
* AT&T vs Intel assembly syntax: Syntax.
* atan, inaccuracies with FP emulator: Emulator accuracy.
* Automated downloading from a PC: DJGPP = Fatware.
* Automated downloading from a Unix box: DJGPP = Fatware.
* Automated FTP from a Unix box: DJGPP = Fatware.
* Automatic variables, how much memory: Stack size.
* Bad format, profiler error message: Gprof needs COFF.
* Binary data I/O: File data corrupted.
* BIOS service calls: int86.
* BIOS service calls which need buffers: Pointer segment.
* BIOS setup, influence on compilation speed: Slow compiler.
* Browsing documentation: Where is the docs.
* Buffered I/O, effect of buffer size on I/O speed: I/O speed.
* Bug report, how to submit: Changing.
* Bug-tracking system for DJGPP: Changing.
* Bugs, how to browse a list of known DJGPP problems: Changing.
* C library, legal restrictions: Redistribution.
* C programs compilation, recommended system RAM: Minimum.
* C++ class variables under GDB: C++ classes in GDB.
* C++ method names under GDB: C++ classes in GDB.
* C++ programs compilation, recommended system RAM: Minimum.
* C++ programs, large executable: Large image.
* C++ programs, problems with packed structs: Struct packing.
* C++ source, debugger cannot find: GDB and C++ source.
* C++ STL library, not in lgp271b distribution: Unresolved externals.
* C++, missing header files: Missing C++ headers.
* C++-style comments in C programs, GCC won't compile: C++ comments.
* Calling 16-bit code from DJGPP: 16-bit code.
* calloc fails under EMM386 or HIMEM: EMM386 alloc.
* calloc fails under QDPMI or Windows: QDPMI alloc.
* calloc fails under Windows 3.x: Windows alloc.
* calloc fails under Windows 95: Win9x alloc.
* calloc, effect on "Fat DS": Fat DS.
* Can't find node "Top", Info message: Info can't find ``Top''.
* CCT mirrors' list: CCT.
* CD-ROM, getting DJGPP: DJGPP by WWW.
* Chaining interrupt: Hardware interrupts.
* Changing GNU/DJGPP programs: Changing.
* Child processes, spawning under OS/2: OS/2.
* Child programs, how much memory is left: Swap out.
* Class method name in GDB: C++ classes in GDB.
* Class static variable name in GDB: C++ classes in GDB.
* Code is slow due to incorrect alignment by GAS: Pentium.
* Code page change might prevent MSHELL from working: Debug graphics.
* Code quality, GCC: How fast.
* Code speed, slower than in v1.x: Faster v1.
* Code, DJGPP-specific: DJGPP-specific.
* COFF output from linker, how to get: GDB needs COFF.
* COFF output, required for profiling: Gprof needs COFF.
* Color text cannot be printed with `printf': Screen I/O.
* Command line, disabling filename expansion/globbing: Disable globbing.
* Command line, escaping special characters: Special chars.
* Command line, filename expansion/globbing: Filename globbing.
* Command lines, longer than 126 characters: Long commands.
* Command-line arguments: Command line.
* Comments, C++-style in C programs: C++ comments.
* Commercial programs, writing with DJGPP: Applications.
* Compatibility, hardware, general: Requirements.
* Compatibility, Linux: Minimum.
* Compatibility, Novell NWDOS 7: Minimum.
* Compatibility, operating systems, general: Requirements.
* Compatibility, OS/2: Minimum.
* Compatibility, Warp: Minimum.
* Compatibility, Windows 3.x: Minimum.
* Compatibility, Windows 9x: Minimum.
* Compatibility, Windows/NT: Minimum.
* Compilation for debugging: How to debug.
* Compilation messages, bogus: Which language.
* Compilation progress, GCC switch: GCC optimizations.
* Compilation speed: Slow compiler.
* Compile-time problems: Compiling.
* Compiler crashes, which subprogram of: General trouble.
* Compiler speed: Compiler performance.
* Compiling GCC and CPP: Reasonable hardware.
* Compiling GCC and CPP, RAM disk: Config.
* Compiling large programs, disk cache settings: Reasonable hardware.
* Compiling large programs, RAM disk settings: Reasonable hardware.
* Compiling large source files: Reasonable hardware.
* Compiling Objective C sources: Objective C.
* Complex class is not in libgpp.a: Class Complex.
* Complex class, porting to libgpp.a 2.7.1 and later: Class Complex.
* Complex template class: Class Complex.
* Compressing DJGPP executables: Large executable.
* Configuration, for optimal performance: Config.
* Configuration, reasonable: Reasonable hardware.
* Configuration, the best: Optimal hardware.
* Conventional memory, moving data to/from: Xfer.
* Conversion of the FAQ to different formats: FAQ format.
* Converting DOS .obj/.lib files to GCC: OBJ and LIB.
* Converting DOS code to DJGPP: Converting.
* Coprocessor setup, change with _control87: Numeric exceptions.
* Copyleft, effect on DJGPP: Applications.
* Copyright issues: Legalese.
* Crash traceback, how to read: Crash traceback.
* Crash, DJGPP programs: Trouble.
* Crash, numeric exception: Numeric exceptions.
* Crashes, general troubleshooting: General trouble.
* Crashes, v2.0 programs: v2.x crash.
* Critical error handling in DJGPP: Int 24h.
* Cross-compiling with DJGPP: Cross-DJGPP.
* crt0.o, GCC can't find: Missing headers/libraries.
* Ctrl-C in debugged programs: Debugging woes.
* Curses library for DJGPP: Samples.
* Cygnus GCC port to Windows: Windows/NT.
* Cygnus port of GCC for WinNT and Win95: Windows apps.
* DEADBEAF, use to spot uninitialized memory: v2.x crash.
* Debugger cannot find C++ source: GDB and C++ source.
* Debugger causes programs to overflow the stack: Stack size.
* Debugger crashes on programs compiled for profiling: Debugging woes.
* Debugger crashes on programs which use exceptions: Debugging woes.
* Debugger crashes under QEMM/QDPMI: Old QDPMI.
* Debugger doesn't know about #include'd source: Included source.
* Debugger doesn't pass signals to debuggee: Debugging woes.
* Debugger, usage: How to debug.
* Debuggers for DJGPP programs: How to debug.
* Debuggers use transfer buffer: Transfer buffer.
* Debugging C++ programs: GDB and C++ source.
* Debugging C/C++ code generated by a program: Included source.
* Debugging graphics programs: Debug graphics.
* Debugging issues: Debugging.
* Debugging symbols, how to strip from executables: Large executable.
* Debugging with GDB, needs COFF output: GDB needs COFF.
* Development environments for DJGPP: Samples.
* Differences between SimTel and CCT ftp sites: Where to find.
* Direct hardware access on Win/NT: Windows/NT.
* Disabling globbing in filenames: Disable globbing.
* Disabling QDPMI: Old QDPMI.
* Disabling virtual memory for CWSDPMI: Slow compiler.
* Disabling wildcard expansion: Disable globbing.
* Disk cache, influence on compilation speed: Slow compiler.
* Disk cache, recommended settings: Config.
* Disk cache, when compiling large programs: Reasonable hardware.
* Disk space, required for installation: Minimum.
* Disk space, using less of it: DJGPP = Fatware.
* Distributing DJGPP programs: Distributing.
* Distributing DJGPP programs, FP emulator: Emulation.
* DJGPP applications, legal restrictions: Applications.
* DJGPP archives, how to search: Deja vu.
* DJGPP as cross-compiler: Cross-DJGPP.
* DJGPP distribution, list of: What to download.
* DJGPP Documentation: Docs.
* DJGPP documentation, in man page format: Man pages.
* DJGPP documentation, in PostScript format: Ready PS.
* DJGPP documentation, look in source distributions: Can't find docs.
* DJGPP documentation, printing: Printed docs.
* DJGPP documentation, reading as ASCII file: No Info.
* DJGPP documentation, reading with a Web browser: Ready PS.
* DJGPP documentation, see source files: Last resort.
* DJGPP documentation, where to find it: Where is the docs.
* DJGPP environment variable, how to set and test: Missing headers/libraries.
* DJGPP environment variable, setting under LFN: Missing headers/libraries.
* DJGPP mailing list, duplicate messages: Duplicates.
* DJGPP mailing list, how to post: Mailing list.
* DJGPP mailing list, how to subscribe: Subscribing.
* DJGPP mailing list, how to unsubscribe: Unsubscribing.
* DJGPP mailing list, in digest form: Subscribing.
* DJGPP mailing list, no messages: Silent list.
* DJGPP mailing list/news group, read via WWW: Unsubscribing.
* DJGPP News group: Newsgroup.
* DJGPP News group, reading via WWW: Subscribing.
* DJGPP programs, problems with: Trouble.
* DJGPP programs, problems with DPMI host: Buggy DPMI.
* DJGPP programs, profiling: How to profile.
* DJGPP software, where to upload: Upload.
* DJGPP users, asking for help: Totally lost.
* DJGPP utilities, legal restrictions: Redistribution.
* DJGPP v2.0, alternative DPMI hosts: Environment.
* DJGPP won't run, prints "No DPMI": No DPMI.
* DJGPP, a list of packages: What to download.
* DJGPP, downloading via e-mail: DJGPP by WWW.
* DJGPP, downloading with FTP: How to download.
* DJGPP, downloading with Gopher: DJGPP by WWW.
* DJGPP, downloading with WWW: DJGPP by WWW.
* DJGPP, how to get it: Getting DJGPP.
* DJGPP, sample code: Samples.
* DJGPP, what it is: DJGPP.
* DJGPP, where to download: Where to find.
* DJGPP-ANNOUNCE mailing list: Subscribing.
* DJGPP-compiled programs can't find DPMI: Distributing.
* DJGPP-specific code: DJGPP-specific.
* DJGPP.ENV syntax explained: Missing headers/libraries.
* DJGPP.ENV, trailing junk crashes Info: Buggy DPMI.
* djgpp_first_ctor, unresolved by linker: djgpp_first_ctor.
* djgpp_first_dtor, unresolved by linker: djgpp_first_ctor.
* Documentation, converting to plain ASCII: No Info.
* Documentation, converting to PostScript format: Printed docs.
* Documentation, in man page format: Man pages.
* Documentation, in PostScript format: Ready PS.
* Documentation, inside source distribution archives: Can't find docs.
* Documentation, reading: Where is the docs.
* Documentation, the profiler: Gprof docs.
* DOS code, using with GCC: 16-bit code.
* DOS libraries, using with GCC: OBJ and LIB.
* DOS object files, using with GCC: OBJ and LIB.
* DOS programs, converting to DJGPP: Converting.
* DOS service calls: int86.
* DOS service calls which need buffers: Pointer segment.
* DOSEmu, incompatibilities with DJGPP: DOSEmu.
* Downloading DJGPP via e-mail: How to download.
* Downloading DJGPP with FTP: How to download.
* Downloading DJGPP with WWW: DJGPP by WWW.
* DPMI host bugs, might crash DJGPP programs: Buggy DPMI.
* DPMI hosts, commercially available: Environment.
* DPMI services, problems with Novell NWDOS 7: Minimum.
* DPMI services, required to run DJGPP: Minimum.
* DPMI spec, where to get it: DPMI Spec.
* DPMI, required to run DJGPP programs: Distributing.
* Duplicate messages from DJGPP mailing list: Duplicates.
* DXE can be debugged with EDEBUG32: How to debug.
* DXE description: DXE.
* DXE docs and examples: DXE.
* E-mail, downloading DJGPP: DJGPP by WWW.
* Emulation, floating-point: Floating point.
* Emulator library: Emulation.
* Emulator, floating-point inaccuracies: Emulator accuracy.
* Environment size affects spawning child programs: How long.
* Environment variables, DJGPP: Optimal hardware.
* Environment variables, linker: Libraries' order.
* Error messages, redirecting to a file: Redirect.
* Excessive paging, tuning CWSDPMI: Config.
* EXE compressor for DJGPP: Large executable.
* Executable size, how to make smaller: Large executable.
* Executable, bloated by static array: Large image.
* Executable, how to strip off debugging symbols: Large executable.
* FAQ, conversion to different formats: FAQ format.
* Far pointer memory access: Direct access.
* Farptr functions, mask off 12 higher bits of address: 20 bits.
* Fatal signal, GCC message: Fatal signal.
* File format not recognized by GCC: Which language.
* Filename globbing: Filename globbing.
* Filename globbing, disabling: Disable globbing.
* Filename wildcards expansion: Filename globbing.
* Filename wildcards, disabling expansion: Disable globbing.
* Files, minimum set to download: What to download.
* Files, reading and writing: File data corrupted.
* Files, required disk space: Disk space.
* Floating-point emulation: Floating point.
* Floating-point emulation doesn't work: Emulation.
* Floating-point emulation under debugger: Debugging woes.
* Floating-point emulation, -msoft-float switch: -msoft-float.
* Floating-point emulation, non-DJGPP emulators: Other emulators.
* Floating-point emulation, under OS/2: OS/2 emulation.
* Floating-point exception in Objective-C program: SIGFPE with ObjC.
* Floating-point issues: Floating point.
* Floating-point math functions, standard and high-quality: Unresolved externals.
* Floating-point, debugger support: How to debug.
* FP_SEG and FP_OFF, porting to DJGPP: NEAR and FAR.
* free doesn't change virtual memory: Confusing alloc.
* FTP, downloading DJGPP: How to download.
* FTP, downloading DJGPP in batch mode: DJGPP = Fatware.
* Functions from libm.a crash with SIGFPE: SIGFPE in ldexp.
* Functions, which is in what library: Which library.
* Game programming, libraries and techniques for DJGPP: Samples.
* Garbage at end of number, GCC message: 0xfe+0x20.
* GCC aborts with "Internal compiler error": Fatal signal.
* GCC can't recognize file format: Which language.
* GCC can't recognize source language: Which language.
* GCC crashes, which subprogram of: General trouble.
* GCC hangs/crashes under Make: Make hangs.
* GCC says "Fatal signal X": Fatal signal.
* Getting DJGPP <1>: Getting DJGPP.
* Getting DJGPP: Where to find.
* getting DJGPP from a CD-ROM: DJGPP by WWW.
* Getting documentation: Where is the docs.
* Getting more help: Help.
* Globbing in filenames: Filename globbing.
* Globbing in filenames, disabling: Disable globbing.
* GNU Copyleft, effect on DJGPP: Applications.
* GNU development utilities, port to DJGPP: Samples.
* GNU News groups, don't post DJGPP problems: DJGPP isn't GNU.
* GNU packages, how to change: Changing.
* Gopher, downloading DJGPP: DJGPP by WWW.
* gotoxy doesn't work with `printf': Screen I/O.
* GPL, effect on DJGPP: Applications.
* Graphics driver setup: Which driver.
* Graphics issues: Graphics.
* Graphics programs, debugging: Debug graphics.
* Graphics screen messed up under Windows: GRX and Windows.
* Graphics, direct video access: Direct access.
* Graphics, limitations on Win/NT: Windows/NT.
* Gurus, asking for help: Totally lost.
* Hang, all DJGPP programs: Buggy DPMI.
* Hang, DJGPP programs: Trouble.
* harderr function, emulating under DJGPP: Int 24h.
* Hardware interrupt handler crashes: HW Int pitfalls.
* Hardware interrupts, hooking: Hardware interrupts.
* Hardware interrupts, subtleties: HW Int pitfalls.
* Hardware requirements: Requirements.
* Hardware requirements, minimal: Minimum.
* Hardware-oriented programming: Low-level.
* Header files, C++, GCC can't find: Missing C++ headers.
* Header files, GCC can't find: Missing headers/libraries.
* Help, asking for: Totally lost.
* HTML format, DJGPP documentation: Ready PS.
* I/O speed, DJGPP programs: I/O speed.
* i286: i286.
* i386SX: Minimum.
* Inaccuracies, using emulator: Emulator accuracy.
* Including source code, problems with debugging: Included source.
* Incompatibilities, i286: i286.
* Incompatibilities, Linux DOSEmu: DOSEmu.
* Incompatibilities, OS/2: OS/2.
* Incompatibilities, Warp: OS/2.
* Incompatibilities, Windows/NT: Windows/NT.
* Info won't display a file: Info can't find ``Top''.
* Inline assembly, how to write: Inline Asm.
* Inline functions, linker won't find: Still unresolved.
* inp function: Ports.
* Int 24h crashes DJGPP programs: Int 24h.
* int86 crashes program: int86.
* int86x/intdosx, how to pass a buffer: Pointer segment.
* intdos crashes program: int86.
* Intel assembly syntax, converting to AT&T: Converting ASM.
* Intel vs AT&T assembly syntax: Syntax.
* Interactive programs, screen I/O: Screen I/O.
* Internal compiler error, when compiling C++ programs: Fatal signal.
* Interrupt 24h handling: Int 24h.
* Interrupt chaining: Hardware interrupts.
* Interrupt frequency, maximum: HW Int pitfalls.
* Interrupt handlers, locking memory: HW Int pitfalls.
* Interrupt reflection: Hardware interrupts.
* Interrupt reflection overhead: HW Int pitfalls.
* Interrupts handlers in DJGPP: Hardware interrupts.
* Invoking v2 programs from v1.x programs: go32-v2.
* Keyboard interrupt cannot be hooked under debugger: Debugging woes.
* Keystrokes don't get to keyboard handler: HW Int pitfalls.
* Known bugs in DJGPP, how to browse: Changing.
* ldexp crashes programs with FP exception: SIGFPE in ldexp.
* Legal aspects of DJGPP programming: Legalese.
* Legal restrictions on DJGPP apps: Applications.
* Legal restrictions, DJGPP utilities: Redistribution.
* Length of command line: How long.
* Letter case in filenames submitted to GCC: Which language.
* LFN API, not supported on Win/NT: Windows/NT.
* LFN problems: LFN.
* LGPL, effect on DJGPP: Applications.
* libc2.tex, missing file: Printed docs.
* Libraries, converting to DJGPP: Converting.
* Libraries, GCC can't find: Missing headers/libraries.
* Libraries, order on compilation/link command line: Libraries' order.
* Libraries, searching for functions: Which library.
* Library docs, missing libc2.tex: Printed docs.
* Library functions, C++, linker won't find: Still unresolved.
* Library functions, linker won't find: Unresolved externals.
* Library functions, linker won't find in non-default directories: Libraries' order.
* Library functions, linker won't find, libraries' order: Libraries' order.
* Library, floating-point emulation: Emulation.
* Linear address, mask off 12 higher bits: 20 bits.
* Linear frame buffer access: Direct access.
* Link-time problems: Compiling.
* Linker fails because of Win95 shortcut files: Win95 LNK files.
* Linker fails for large libraries or object files: Large object files.
* Linker fails to find crt0.o under Novell: Missing headers/libraries.
* Linker fails to produce executable under Novell: No EXE.
* Linker speed: Compiler performance.
* linker won't find djgpp_first_dtor symbol: djgpp_first_ctor.
* Linking C++ programs, use the GXX driver: Unresolved externals.
* Linking programs, unresolved C++ library functions: Still unresolved.
* Linking programs, unresolved library functions: Unresolved externals.
* Linking programs, unresolved library functions, libraries' order: Libraries' order.
* Linking speed, improve by stub-editing ld.exe: Slow linker.
* Links, symbolic, simulation with DJGPP: Symlinks.
* List of DJGPP packages: What to download.
* Locking memory for hardware interrupt handlers: Hardware interrupts.
* Locking memory for interrupt handlers: HW Int pitfalls.
* Long command lines: Long commands.
* Long command lines, from Makefile: Makefiles.
* Long command lines, maximum length: How long.
* long filename support, bugs: LFN.
* Long Filenames aren't supported on Win/NT: Windows/NT.
* Long filenames in setting DJGPP env. variable: Missing headers/libraries.
* Low-level programming issues: Low-level.
* Machines with low extended RAM, tuning CWSDPMI: Config.
* Makefile, first character of every command must be TAB: Missing separator.
* Makefile, passing long command lines: Makefiles.
* Makefiles with long command lines: Long commands.
* malloc doesn't change virtual memory: Confusing alloc.
* malloc fails under EMM386 or HIMEM: EMM386 alloc.
* malloc fails under QDPMI or Windows: QDPMI alloc.
* malloc fails under Windows 3.x: Windows alloc.
* malloc fails under Windows 95: Win9x alloc.
* malloc, effect on "Fat DS": Fat DS.
* Man pages, how to read: Man pages.
* Math functions crash with SIGFPE: SIGFPE in ldexp.
* Maximum interrupt frequency: HW Int pitfalls.
* Maximum length of command line: How long.
* Memory allocation fails under EMM386 or HIMEM: EMM386 alloc.
* Memory allocation fails under QDPMI or Windows 95: QDPMI alloc.
* Memory allocation fails under Windows 3.x: Windows alloc.
* Memory allocation fails under Windows 95: Win9x alloc.
* Memory at run time: Memory.
* Memory locking for hardware interrupt handlers: Hardware interrupts.
* Memory manager, settings for optimal performance: Config.
* Memory, how much is left for spawned programs: Swap out.
* Memory, virtual, failure to allocate: QDPMI VM.
* Memory, virtual, free doesn't change: Confusing alloc.
* Memory, virtual, malloc doesn't change: Confusing alloc.
* Memory, virtual, maximum available: How much memory.
* Memory, virtual, QDPMI failure: QDPMI VM.
* Memory-mapped devices above 1MB: Above 1MB.
* Memory-mapped devices, fast access: Fat DS.
* Memory-mapped devices, moving data to/from: Xfer.
* Method name in C++, how to pass to GDB: C++ classes in GDB.
* Minimal hardware requirements: Minimum.
* Minimum system RAM: Minimum.
* Minimum system RAM, CWSDPMI: Minimum.
* Missing C++ header files: Missing C++ headers.
* Missing crt0.o: Missing headers/libraries.
* Missing header files: Missing headers/libraries.
* Missing libraries: Missing headers/libraries.
* Missing separator, Make error message: Missing separator.
* Mixing v2.0 GCC with CC1PLUS from v1.x, Unknown filetype message.: Unknown filetype.
* Mixing v2.x Make with v1.x programs hangs the machine: Make hangs.
* MK_FP macro, porting to DJGPP: NEAR and FAR.
* Mode switches, effect on program speed: How fast.
* Monochrome monitor, redirecting screen output: Debug graphics.
* More help, how to get: Help.
* Motorola 68K targets, cross-compiling with DJGPP: Cross-DJGPP.
* Mouse handler with DJGPP: RMCB.
* movedata, mask off 12 higher bits of address: 20 bits.
* Moving data to and from conventional memory: Xfer.
* Moving data to and from transfer buffer: Xfer.
* MS-Windows header file windows.h, where to get it: Windows apps.
* MS-Windows programming under DJGPP: Windows apps.
* Nearptr functions: Fat DS.
* Nearptr functions, mask off 12 higher bits of address: 20 bits.
* nearptr method of direct memory access: Xfer.
* Nested programs, how much memory is left: Swap out.
* Network installation makes linking slow: Slow linker.
* New features in v2.0: New and improved.
* No DPMI error message: No DPMI.
* No messages from the mailing list: Silent list.
* Non-DJGPP floating-point emulators: Other emulators.
* Not COFF error message from DJGPP programs: Unknown filetype.
* Novell NDOS, buggy DPMI services crash DJGPP: Buggy DPMI.
* Novell, linker or STUBIFY don't produce executable: No EXE.
* Null pointer dereference crashes v2.0 programs: v2.x crash.
* Numeric exception, program crash: Numeric exceptions.
* Objective C, compiling: Objective C.
* Objective-C programs crash with FP exception: SIGFPE with ObjC.
* Old CWSDPMI, influence on compilation speed: Slow compiler.
* Optimal performance, CWSDPMI tuning: Config.
* Optimal performance, disk cache settings: Config.
* Optimal performance, RAM disk settings: Config.
* Optimal performance, system configuration: Config.
* Optimization crashes GCC: GCC optimizations.
* Optimizing DJGPP programs: How to profile.
* outp function: Ports.
* Overhead, interrupt reflection to protected mode: HW Int pitfalls.
* Packages, DJGPP, list of: What to download.
* Packages, ported to DJGPP: Samples.
* Packages, required disk space: Disk space.
* Packages, which to download: What to download.
* Packed structs, C++ bug: Struct packing.
* Packing the structs: Struct size.
* Page fault error message from CWSDPMI: v2.x crash.
* Paging starts before all RAM is used: EMM386 alloc.
* Peek/poke absolute address: Xfer.
* Performance issues: Performance.
* Peripheral devices above 1MB: Above 1MB.
* Peripheral devices, fast access: Fat DS.
* Peripheral devices, reading/writing ports: Ports.
* Peripherals, moving data to/from: Xfer.
* Pi, accurate computation: Emulator accuracy.
* Port reading/writing: Ports.
* Ported programs run much slower: Slow-down.
* Posting problems, not to GNU News groups: DJGPP isn't GNU.
* Posting to DJGPP mailing list: Mailing list.
* PostScript documentation: Printed docs.
* PostScript documentation, ready-to-print: Ready PS.
* Pre-processor symbols, DJGPP-specific: DJGPP-specific.
* printf cannot print color text: Screen I/O.
* Printing DJGPP documentation: Printed docs.
* Problems with DJGPP programs: Trouble.
* Problems, asking for help: Totally lost.
* Problems, searching for solution in DJGPP archives: Deja vu.
* Profiled programs crash under debugger: Debugging woes.
* Profiler documentation: Gprof docs.
* Profiler produces no output: No profile.
* Profiling DJGPP programs: How to profile.
* Profiling DJGPP programs, need COFF output: Gprof needs COFF.
* Profiling issues: Profiling.
* Profiling programs that terminate abnormally: No profile.
* Profiling, library routines: I/O bound programs.
* Program crashes accessing empty floppy/CD-ROM drives: Int 24h.
* Program crashes because of Int 24h: Int 24h.
* Program crashes in int86/intdos: int86.
* Program crashes in v2.0, but not in v1.x: v2.x crash.
* Program crashes while allocating memory: QDPMI alloc.
* Programs crash with SIGSEGV due to small stack size: Stack size.
* Programs crash, general troubleshooting: General trouble.
* Programs crash, numeric exception: Numeric exceptions.
* Programs crash, saving debugging output: Redirect.
* Programs crash, searching DJGPP archives: Deja vu.
* Programs that exit abnormally, how to profile: No profile.
* Protected mode and converted assembly code: ASM GPF.
* Protected-mode interrupt vector: Hardware interrupts.
* QEMM auto/off mode, conflicts with DJGPP: QEMM AUTO.
* Quotes, how to pass them to programs: Special chars.
* RAM disk, influence on compilation speed: Slow compiler.
* RAM disk, recommended settings: Config.
* RAM disk, when compiling large programs: Reasonable hardware.
* RCS port to DJGPP: Samples.
* Read DJGPP traffic via WWW: Unsubscribing.
* Reading an int from a binary file: Struct size.
* Reading documentation: Where is the docs.
* Reading documentation with text editor/viewer: No Info.
* Reading documentation, converting to plain ASCII: No Info.
* Reading structs from disk files: Struct size.
* Real-mode call-back: RMCB.
* Real-mode interrupt vector: Hardware interrupts.
* Real-mode services, calling DJGPP functions: RMCB.
* realloc, effect on "Fat DS": Fat DS.
* Reboot, every DJGPP program: Buggy DPMI.
* Reboot, when running DJGPP programs: Trouble.
* Recommended system RAM, for C programs compilation: Minimum.
* Recommended system RAM, for C++ programs compilation: Minimum.
* Recompiling GCC: Changing.
* Redirecting GCC messages to a file: Redirect.
* Redirection in Makefile, effect on long command lines: Makefiles.
* Redirection, using the REDIR program: Makefiles.
* Required hardware, general: Requirements.
* Response file, passing long command lines: Long commands.
* Run-time environment in v2.0: Environment.
* Run-time performance: Performance.
* Run-time problems: Running.
* Runtime speed, slower than in v1.x: Faster v1.
* sbrk, effect on "Fat DS": Fat DS.
* Screen contents not restored under Windows: GRX and Windows.
* Screen I/O: Screen I/O.
* Searching DJGPP archives: Deja vu.
* setvbuf, effect on I/O speed: I/O speed.
* SHELL= variable in Makefile, effect on long command lines: Makefiles.
* Shortcut files under Win95 fail DJGPP linker: Win95 LNK files.
* Signals in debugged programs: Debugging woes.
* SimTel mirrors' list: Where to find.
* Size of a struct under DJGPP: Struct size.
* Slow code, due to bad alignment by GAS: Pentium.
* Slow compilation: Slow compiler.
* Slow compilation, tuning CWSDPMI: Config.
* Slow linking, possible reasons: Slow linker.
* Slow-down, programs ported from other compilers: Slow-down.
* Software interrupts, need zero SS, SP and FLAGS: Zero SP.
* Solved problems, searching in DJGPP archives: Deja vu.
* Sound Blaster code for DJGPP: Samples.
* Source files, using as the best docs: Last resort.
* Spawned programs, how much memory is left: Swap out.
* Spawning child processes, OS/2: OS/2.
* Spawning programs, effect of environment size: How long.
* Spawning v2 programs from v1.x programs: go32-v2.
* Spawning v2.x programs from v1.x programs doesn't work: Make hangs.
* Speed of compilation: Slow compiler.
* Stack dump, how to read: Crash traceback.
* Stack overflow under debugger: Stack size.
* Stack size under DJGPP: Stack size.
* Stack size, insufficient, causes programs to crash: Stack size.
* Stand-alone DJGPP programs that don't need DPMI: Distributing.
* Standard output/error stream, redirecting to a file: Redirect.
* Static array enlarges C++ executable: Large image.
* STL library, not in lgp271b distribution: Unresolved externals.
* struct reading from a disk file: Struct size.
* Struct, size in bytes under DJGPP: Struct size.
* Structure packing, C++ bug: Struct packing.
* Structure padding: Struct size.
* Subscription to DJGPP mailing list: Subscribing.
* Subsidiary programs, how much memory is left: Swap out.
* SVGA types supported by GRX: Which driver.
* Symbolic links, simulation with DJGPP: Symlinks.
* System configuration, the best: Optimal hardware.
* System RAM, minimum: Minimum.
* Systems programming issues: Low-level.
* TAB, must be the first character of every command: Missing separator.
* TABs replaced with spaces by a text editor: Missing separator.
* TCP/IP library for DJGPP: Samples.
* Text-mode video memory access: Direct access.
* Timer interrupts code for DJGPP: Samples.
* Traceback, how to read: Crash traceback.
* Tracing compilation progress with -Q: GCC optimizations.
* Transfer buffer, mask off 12 higher bits of address: 20 bits.
* Transfer buffer, moving data: Xfer.
* Transfer buffer, use when debugging: Transfer buffer.
* Transfer buffer, using to call DOS/BIOS: Pointer segment.
* Tuning CWSDPMI for optimal performance: Config.
* Turbo Vision, DJGPP port: Samples.
* TZ database updates, where to get: Zoneinfo.
* TZ variable, how to set: Zoneinfo.
* Uninitialized memory crashes v2.0 programs: v2.x crash.
* Unix-like sbrk algorithm considered harmful for HW interrupts: HW Int pitfalls.
* Unix-to-DOS cross-compiling with DJGPP: Cross-DJGPP.
* Unknown filetype, GCC message: Unknown filetype.
* Unresolved __pure_virtual function in C++: Pure virtual.
* Unresolved externals: Unresolved externals.
* Unresolved externals in C++ programs, use GXX: Unresolved externals.
* Unresolved externals, C++: Still unresolved.
* unresolved externals, djgpp_first_ctor: djgpp_first_ctor.
* Unsubscribing from the DJGPP mailing list: Unsubscribing.
* Unsupported DOS request message: int86.
* Unsupported INT message: int86.
* Uploading DJGPP software: Upload.
* v2 code slower than v1.x: Faster v1.
* V2.0, new environment: Environment.
* V2.0, new features and bug fixes: v2.
* v2.0, program crashes: v2.x crash.
* V86 mode, QEMM and CWSDPMI problems: QEMM AUTO.
* VBE 2.0 linear frame buffer access: Direct access.
* VESA support by GRX: Which driver.
* VGA Mode-X graphics for DJGPP: Samples.
* Video memory, direct access: Direct access.
* Virtual memory: Memory.
* Virtual memory under Windows 95: Win9x alloc.
* Virtual memory, failure to allocate: QDPMI VM.
* Virtual memory, free doesn't change: Confusing alloc.
* Virtual memory, how to disable it for CWSDPMI: Slow compiler.
* Virtual memory, malloc doesn't change: Confusing alloc.
* Virtual memory, maximum available: How much memory.
* Virtual memory, QDPMI failure: QDPMI VM.
* Virus infection cause "Not COFF" message: Unknown filetype.
* Web site for DJGPP: WWW.
* Weekly digest, problems in receiving: Subscribing.
* Wildcards expansion: Filename globbing.
* Wildcards expansion, disabling: Disable globbing.
* Win32 programming with GCC: Windows apps.
* Windows applications with DJGPP: Windows apps.
* WinNT/Win95 programming with Cygnus GCC port: Windows apps.
* WWW services for DJGPP: WWW.
* WWW, downloading DJGPP: DJGPP by WWW.
* X emulation for DJGPP: Samples.
* Zoneinfo directory: Zoneinfo.
File: djgppfaq.info, Node: Program Index, Prev: Topic Index, Up: Top
25. Program Index
*****************
This index lists the problems and solutions by the program/package to which
they pertain. If you know what program or package gives you the trouble,
look it up here.
* Menu:
* 386Max, how to ensure virtual memory: QDPMI VM.
* 386Max, speeding up DJGPP start-up: QDPMI VM.
* 4DOS, redirecting GCC messages to a file: Redirect.
* _control87, change coprocessor setup: Numeric exceptions.
* _crt0_startup_flags settings and QDPMI: QDPMI VM.
* _crt0_startup_flags, setting to lock memory: HW Int pitfalls.
* _crt0_startup_flags, Unix sbrk is incompatible with HW interrupts: HW Int pitfalls.
* _string.h, GCC can't find: Missing C++ headers.
* AutoWinNet, automated downloading: DJGPP = Fatware.
* BatchFTP, automated downloading from a Unix box: DJGPP = Fatware.
* BCCBGI (from BCC2GRX) crashes with the default stack: Stack size.
* Bison doesn't imply GPL/LGPL: Applications.
* Bison, debugging generated code: Included source.
* C compiler overflows its stack for large programs: Fatal signal.
* C++ class libraries, legal restrictions: Applications.
* C++ compiler crashes for large programs: Stack size.
* C++ compiler overflows its stack for large programs: Fatal signal.
* Cawf, using to read man pages: Man pages.
* CC1PLUS crashes with SIGSEGV: Stack size.
* CHCP DOS command might prevent MSHELL from working: Debug graphics.
* complex.h functions, linker can't find: Still unresolved.
* Complex.h, GCC can't find: Missing C++ headers.
* CPP, compiling, memory requirements: Reasonable hardware.
* CPP, compiling, RAM disk: Config.
* CTRL87, control numeric exceptions: Numeric exceptions.
* CWSDPMI allows "Fat DS": Fat DS.
* CWSDPMI crashes programs allocating memory is small chunks: QDPMI alloc.
* CWSDPMI crashes programs which dereference NULL pointers: v2.x crash.
* CWSDPMI doesn't support hooking Int 24h: Int 24h.
* CWSDPMI runs out of virtual memory: Fatal signal.
* CWSDPMI, alternative DPMI hosts: Environment.
* CWSDPMI, disabling virtual memory: Slow compiler.
* CWSDPMI, legal restrictions: Redistribution.
* CWSDPMI, maximum available virtual memory: How much memory.
* CWSDPMI, memory usage for nested programs: Swap out.
* CWSDPMI, minimum required system RAM: Minimum.
* CWSDPMI, old (beta) versions slow-down compilation: Slow compiler.
* CWSDPMI, pages too early under EMM386: EMM386 alloc.
* CWSDPMI, problems with QEMM auto/off mode: QEMM AUTO.
* CWSDPMI, setting parameters for optimal performance: Config.
* CWSDPMI, should be distributed with DJGPP programs: Distributing.
* CWSDPR0 reduces interrupt reflection overhead: HW Int pitfalls.
* CWSDPR0, use for testing HW interrupt handlers: Hardware interrupts.
* CWSPARAM, a program to tune CWSDPMI performance: Config.
* DJGPP.ENV syntax explained: Missing headers/libraries.
* DJGPP.ENV, beware of blanks when setting: Missing headers/libraries.
* DJGPP.ENV, compiler environment variables: Missing headers/libraries.
* DJGPP.ENV, linker environment variables: Libraries' order.
* DJP, an executable compressor for DJGPP: Large executable.
* DOSEMU doesn't allow "Fat DS": Fat DS.
* EDEBUG32 can debug a DXE: How to debug.
* EMACS can be compiled with DJGPP: Samples.
* Emacs, reading docs: Where is the docs.
* Emacs, reading Info files: Where is the docs.
* Emacs, using to read man pages: Man pages.
* EMM386, cannot use all free memory: EMM386 alloc.
* EMM386, effect on max interrupt frequency: HW Int pitfalls.
* EMM386, malloc/calloc fails: EMM386 alloc.
* EMM386, settings for optimal performance: Config.
* emTeX, printing the docs: Printed docs.
* emu387.dxe, distribution with DJGPP programs: Emulation.
* EMX/GCC, writing Windows applications: Windows apps.
* EMXAOUT converter from .obj to COFF format: OBJ and LIB.
* F2C, debugging generated code: Included source.
* Flex doesn't imply GPL/LGPL: Applications.
* Flex, debugging generated code: Included source.
* FSDB crashes under QEMM/QDPMI: Old QDPMI.
* FSDB, the full-screen debugger: How to debug.
* Gas can introduce errors into assembly code: Gas bugs.
* GCC can't find C++ headers: Missing C++ headers.
* GCC can't find crt0.o: Missing headers/libraries.
* GCC can't find headers: Missing headers/libraries.
* GCC can't find libraries: Missing headers/libraries.
* GCC cannot resolve djgpp_first_ctor symbol when linking: djgpp_first_ctor.
* GCC crashes during optimization: GCC optimizations.
* GCC crashes, which subprogram of: General trouble.
* GCC doesn't pack structs in C++ programs: Struct packing.
* GCC doesn't recognize .lib libraries: OBJ and LIB.
* GCC doesn't recognize .obj object files: OBJ and LIB.
* GCC doesn't recognize file format: Which language.
* GCC from v2.x crashes under v1.x Make: Make hangs.
* GCC hangs under Make: Make hangs.
* GCC says "garbage at end of number": 0xfe+0x20.
* GCC won't compile C++-style comments in C programs: C++ comments.
* GCC won't find inline functions without -O: Still unresolved.
* GCC, -fconserve-space switch: Large image.
* GCC, -msoft-float switch: -msoft-float.
* GCC, -v switch shows the compilation passes: Which language.
* GCC, assumes C++ source is .cc: GDB and C++ source.
* GCC, code efficiency: How fast.
* GCC, compiling for debugging: How to debug.
* GCC, compiling, memory requirements: Reasonable hardware.
* GCC, compiling, RAM disk: Config.
* GCC, environment variables: Missing headers/libraries.
* GCC, file source language recognition: Which language.
* GCC, I/O speed: I/O speed.
* GCC, inline assembly facilities: Inline Asm.
* GCC, maximum length of command line in Makefiles: How long.
* GCC, passing long command lines via Makefile: Makefiles.
* GCC, recompiling: Changing.
* GCC, redirecting messages to a file: Redirect.
* GCC, slow compilation: Slow compiler.
* GDB cannot restart the debuggee: How to debug.
* GDB causes stack overflow in a debuggee: Stack size.
* GDB crashes under QEMM/QDPMI: Old QDPMI.
* GDB doesn't pass command-line arguments to debuggee: How to debug.
* GDB GP Faults on breakpoint under Windows: Debugging woes.
* GDB needs COFF output: GDB needs COFF.
* GDB, conflicts with file redirection: How to debug.
* GDB, debugging DJGPP programs: How to debug.
* GDB, debugging graphics programs: Debug graphics.
* GDB, how is it different on MS-DOS: How to debug.
* GDB, how to use C++ class variables' names: C++ classes in GDB.
* GDB, how to use C++ method names: C++ classes in GDB.
* GDB, init file name: How to debug.
* GDB, name of the READLINE init file: How to debug.
* GDB, slow loading of symbols and sources: How to debug.
* go32-v2 usage: go32-v2.
* go32-v2, use to find out how much memory is available to DJGPP: EMM386 alloc.
* Gprof cannot find program: Gprof needs COFF.
* Gprof documentation: Gprof docs.
* gprof produces no output: No profile.
* Gprof says "bad format": Gprof needs COFF.
* Gprof, documentation: Can't find docs.
* Gprof, the GNU profiler: How to profile.
* Groff, port to DJGPP: Man pages.
* Groff, using to read man pages: Man pages.
* GRX, supported SVGA types: Which driver.
* gxx driver, not in gcc272b distribution: Unresolved externals.
* gxx driver, searches C++ libraries automatically: Unresolved externals.
* HIMEM, malloc/calloc fails: EMM386 alloc.
* INFNG, produces the FAQ in Norton Guides format: FAQ format.
* Info crashes due to ^Z or whitespace at end of DJGPP.ENV: Buggy DPMI.
* Info crashes under QDPMI: Buggy DPMI.
* Info won't display a file: Info can't find ``Top''.
* Info, a stand-alone docs browser: Where is the docs.
* Info, using to read man pages: Man pages.
* iostream functions, linker can't find: Still unresolved.
* iostream library, why use it: Unresolved externals.
* iostream.h, GCC can't find: Missing C++ headers.
* LaTeX, printing the docs: Printed docs.
* ld fails for large libraries and object files: Large object files.
* LD linker, linker script defines djgpp_first_ctor: djgpp_first_ctor.
* ld, how to improve linking speed: Slow linker.
* Less, using to read man pages: Man pages.
* Lex, debugging generated code: Included source.
* libemu.a FP emulation library: Emulation.
* libg++ library: Unresolved externals.
* libgpp library: Unresolved externals.
* libgpp.a, legal restrictions: Applications.
* libiostream.a, legal restrictions: Applications.
* libstdc++ standard templates library: Unresolved externals.
* Linker can't find library functions: Unresolved externals.
* Linker can't find library functions in non-default directories: Libraries' order.
* Linker can't find some C++ library functions: Still unresolved.
* Linker, environment variables: Libraries' order.
* Linker, how to get COFF output: GDB needs COFF.
* Linker, order of libraries in the command line: Libraries' order.
* Linux doesn't allow "Fat DS": Fat DS.
* Linux, compatibility: Minimum.
* Linux, needs a patch to run nested programs: DOSEmu.
* Make crashes on DOSEmu: DOSEmu.
* Make crashes on OS/2: OS/2.
* Make error message "missing separator": Missing separator.
* Make requires floating point: Changing.
* Make, GCC hangs when invoked from it: Make hangs.
* Make, maximum length of command line to pass to GCC: How long.
* Make, passing long command lines via Makefile: Makefiles.
* Makeinfo, using to convert Info files to plain ASCII: No Info.
* MAKERTF, produces the FAQ in RTF format: FAQ format.
* Man program for DJGPP docs: Man pages.
* math library, default ANSI/ISO and high-quality functions: Unresolved externals.
* More, using to read man pages: Man pages.
* Mosaic, downloading DJGPP: DJGPP by WWW.
* MSHELL fails because of TSR programs: Debug graphics.
* MSHELL, redirecting screen output: Debug graphics.
* NDOS, buggy DPMI services crash DJGPP: Buggy DPMI.
* Netscape, downloading DJGPP: DJGPP by WWW.
* NM, printing library contents: Which library.
* Novell 3.x, linker doesn't find crt0.o: Missing headers/libraries.
* Novell NWDOS 7, buggy DPMI services: Minimum.
* Novell NWDOS 7, compatibility: Minimum.
* NWDOS, buggy DPMI services crash DJGPP: Buggy DPMI.
* OBJ2COFF converter from .obj to COFF format: OBJ and LIB.
* OBJDUMP segment overrides bugs: Gas bugs.
* Objective C, compilation problems: Objective C.
* Objective-C, cannot run on machines without FPU: SIGFPE with ObjC.
* obstack package: Unresolved externals.
* OS/2 Warp allows "Fat DS": Fat DS.
* OS/2, compatibility: Minimum.
* OS/2, floating point emulation: OS/2 emulation.
* OS/2, incompatibilities: OS/2.
* PMODE/DJ reduces interrupt reflection overhead: HW Int pitfalls.
* PMODE/DJ, can be used to produce stand-alone programs: Distributing.
* QDPMI allows "Fat DS": Fat DS.
* QDPMI and _crt0_startup_flags settings: QDPMI VM.
* QDPMI crashes debugger: Old QDPMI.
* QDPMI crashes DJGPP programs when they cause Int 24h: Int 24h.
* QDPMI crashes Info: Buggy DPMI.
* QDPMI fails to provide virtual memory: QDPMI VM.
* QDPMI, how to disable: Old QDPMI.
* QDPMI, malloc/calloc failure: QDPMI alloc.
* QDPMI, memory usage for nested programs: Swap out.
* QEMM crashes debugger: Old QDPMI.
* QEMM, auto/off mode, conflicts with CWSDPMI: QEMM AUTO.
* QEMM386, settings for optimal performance: Config.
* RCS port to DJGPP: Samples.
* REDIR, redirecting GCC messages to a file: Redirect.
* REDIR, redirecting stack dump to a file: Crash traceback.
* REDIR, use to get redirection and long command lines: Makefiles.
* regex package from GNU: Unresolved externals.
* Regex.h, GCC can't find: Missing C++ headers.
* RHIDE, development environment for DJGPP: Samples.
* RSX extender: Windows apps.
* RSXNT toolkit for developing Win32 applications: Windows apps.
* RSXWDK2 Windows development kit: Windows apps.
* sbrk algorithm and QDPMI: QDPMI VM.
* sbrk, Unix-like algorithm is incompatible with HW interrupts: HW Int pitfalls.
* SCRIPT, redirecting GCC messages to a file: Redirect.
* Sed requires floating point: Changing.
* Sed script to convert ASM to AT&T syntax: Converting ASM.
* Sed, documentation: Can't find docs.
* sizeof, result when called on a structure: Struct size.
* stdiostream.h, GCC can't find: Missing C++ headers.
* streambuf.h, GCC can't find: Missing C++ headers.
* STRIP makes executables smaller: Large executable.
* STUBEDIT, changing stack size: Stack size.
* STUBEDIT, effect on memory left to spawned programs: Swap out.
* STUBIFY fails to produce .EXE under Novell: No EXE.
* STUBIFY.EXE, infected by a virus: Unknown filetype.
* SYMIFY, a program to read crash traceback: Crash traceback.
* TA2AS, a converter from Intel to AT&T assembly syntax: Converting ASM.
* TeX, printing the docs: Printed docs.
* TEXI2PS, converting docs to crude PostScript: Printed docs.
* UNIVBE, software VESA 2.0 emulation: Which driver.
* Warp, compatibility: Minimum.
* Warp, incompatibilities: OS/2.
* Win/NT doesn't allow "Fat DS": Fat DS.
* Win/NT doesn't allow port I/O: Windows/NT.
* Win95 long filenames and C++ headers: Missing C++ headers.
* Win95, setting DJGPP environment variable: Missing headers/libraries.
* Windows 3.x allows "Fat DS": Fat DS.
* Windows 3.x, compatibility: Minimum.
* Windows 3.x, malloc/calloc fails: Windows alloc.
* Windows 95 doesn't allow more than 16MB virtual memory: Win9x alloc.
* Windows 95, shortcut files conflict with ld: Win95 LNK files.
* Windows 9x allows "Fat DS": Fat DS.
* Windows 9x, compatibility: Minimum.
* Windows applications, writing with EMX/GCC: Windows apps.
* Windows messes up graphics screen: GRX and Windows.
* Windows, malloc/calloc failure: QDPMI alloc.
* Windows, memory usage for nested programs: Swap out.
* Windows, setting memory parameters for DJGPP: Config.
* Windows, stack size control: Stack size.
* windows.h header file, where to get it: Windows apps.
* Windows/NT, compatibility: Minimum.
* WinNT, setting DJGPP environment variable: Missing headers/libraries.
* WMEMU causes undefined references when linking: Emulation.
* WMEMU, an alternative floating-point emulator: Emulation.
* WMEMU, use when debugging FP programs on non-FPU machine: Debugging woes.
* Yacc, debugging generated code: Included source.
Tag Table:
Node: Top
Node: Urgent
Node: DJGPP
Node: Requirements
Node: Minimum
Node: OS/2
Node: Windows/NT
11362
Node: DOSEmu
13245
Node: i286
14868
Node: Windows apps
15303
Node: Optimal hardware
20106
Node: Reasonable hardware
21130
Node: Config
22160
Node: Getting DJGPP
27521
Node: Where to find
28262
Node: CCT
35782
Node: How to download
39458
Node: DJGPP by WWW
40087
Node: What to download
41540
Node: What to download-Footnotes
46334
Node: Disk space
46596
Node: DJGPP = Fatware
48782
Node: Docs
50698
Node: Where is the docs
51430
Node: No Info
52567
Node: Printed docs
54398
Node: Ready PS
56086
Node: Can't find docs
57553
Node: Man pages
57978
Node: Last resort
61488
Node: Trouble
61858
Node: No DPMI
63242
Node: Buggy DPMI
63768
Node: GCC optimizations
65713
Node: Fatal signal
68505
Node: Unknown filetype
71105
Node: QEMM AUTO
72093
Node: Make hangs
73497
Node: Info can't find "Top"
75299
Node: General trouble
76711
Node: Redirect
77869
Node: Deja vu
79457
Node: Totally lost
82660
Node: Compiler performance
84883
Node: Slow compiler
85586
Node: Slow linker
90071
Node: Compiling
92411
Node: Missing headers/libraries
94279
Node: Missing headers/libraries-Footnotes
100528
Node: Missing C++ headers
100711
Node: C++ comments
104130
Node: Which language
106661
Node: Objective C
108752
Node: DJGPP-specific
109452
Node: Unresolved externals
110634
Node: Which library
112318
Node: Libraries' order
114614
Node: Still unresolved
116442
Node: Class Complex
117028
Node: Pure virtual
118831
Node: djgpp_first_ctor
119961
Node: Large image
121344
Node: Large executable
122405
Node: Win95 LNK files
125316
Node: No EXE
125917
Node: Large object files
127837
Node: Running
128754
Node: v2.x crash
129388
Node: Crash traceback
131869
Node: File data corrupted
134575
Node: Screen I/O
135449
Node: Distributing
137556
Node: Graphics
139187
Node: Which driver
139809
Node: Direct access
141129
Node: GRX and Windows
142851
Node: Floating point
144050
Node: Emulation
144797
Node: Other emulators
147186
Node: OS/2 emulation
147772
Node: -msoft-float
148321
Node: Numeric exceptions
148940
Node: Emulator accuracy
150035
Node: SIGFPE with ObjC
151006
Node: SIGFPE in ldexp
151873
Node: Debugging
152765
Node: How to debug
153670
Node: Old QDPMI
158061
Node: GDB needs COFF
158775
Node: Transfer buffer
159664
Node: Debug graphics
160678
Node: GDB and C++ source
162463
Node: C++ classes in GDB
163428
Node: Included source
164446
Node: Debugging woes
165575
Node: Profiling
167681
Node: How to profile
168281
Node: Gprof needs COFF
168936
Node: Gprof docs
169585
Node: I/O bound programs
170107
Node: No profile
170796
Node: No profile-Footnotes
172538
Node: Performance
172789
Node: How fast
173376
Node: Faster v1
174255
Node: Pentium
175093
Node: I/O speed
176158
Node: Slow-down
177728
Node: Memory
180016
Node: How much memory
180836
Node: Confusing alloc
182113
Node: QDPMI VM
183214
Node: QDPMI alloc
185084
Node: Windows alloc
186990
Node: Win9x alloc
187845
Node: EMM386 alloc
188703
Node: Swap out
189864
Node: Stack size
191926
Node: Command line
196012
Node: Filename globbing
196850
Node: Disable globbing
199151
Node: Special chars
199934
Node: Long commands
201706
Node: Long commands-Footnotes
203827
Node: How long
204135
Node: Makefiles
205659
Node: Converting
206849
Node: Syntax
207565
Node: Gas bugs
210948
Node: Converting ASM
212374
Node: Converting ASM-Footnotes
214397
Node: ASM GPF
214624
Node: OBJ and LIB
216047
Node: OBJ and LIB-Footnotes
218897
Node: 16-bit code
219093
Node: NEAR and FAR
220437
Node: Low-level
222294
Node: int86
223501
Node: Pointer segment
225081
Node: Zero SP
227571
Node: Zero SP-Footnotes
229272
Node: Xfer
229524
Node: 20 bits
233184
Node: Fat DS
234165
Node: Above 1MB
237863
Node: RMCB
238801
Node: Hardware interrupts
239816
Node: _go32 vs __dpmi
247013
Node: HW Int pitfalls
248761
Node: Ports
252470
Node: Inline Asm
253183
Node: Legalese
254523
Node: Applications
254891
Node: Redistribution
258005
Node: Help
260919
Node: DJGPP isn't GNU
261616
Node: Mailing list
262505
Node: Subscribing
262989
Node: Unsubscribing
265413
Node: Silent list
267228
Node: Duplicates
268600
Node: Newsgroup
270437
Node: v2
271426
Node: New and improved
271821
Node: Environment
273130
Node: Miscellany
275291
Node: Changing
276491
Node: Samples
279990
Node: Symlinks
287840
Node: DPMI Spec
289108
Node: WWW
290205
Node: Upload
291056
Node: Cross-DJGPP
293465
Node: 0xfe+0x20
296856
Node: Struct size
297763
Node: Struct size-Footnotes
301765
Node: Struct packing
301914
Node: Int 24h
302636
Node: go32-v2
305104
Node: DXE
305983
Node: LFN
307308
Node: Missing separator
308950
Node: Zoneinfo
309992
Node: FAQ format
313279
Node: About
316086
Node: Topic Index
318784
Node: Program Index
357746
End Tag Table