Mail Archives: djgpp/1997/10/12/00:32:15
Myknees (myknees AT aol DOT com) wrote:
: Now here's the kicker. I also added the -O3 option, and the resulting
: executable was still the same size. Does this mean that all simple
: programs compiled with djgpp will always be inordinately large?
Yup. Not that large though... A very simple program which just prints a
string on the screen and then quits can be as small as 30k IIRC. The `-s'
option should have reduced your file size a bit; try running `strip' on the
executable, which has the same effect.
However, there is a certain amount of startup information and support code
which must be present to take care of a few things... locating a DPMI
server, the switch to protected mode, the command line interpretation,
loading of environment from DJGPP.ENV, etc. You can turn some of these
features off as explained in the FAQ, which will further reduce your code
size.
The real problem, though, is that your program isn't a sensible test of the
compiler's code generation. It's not particularly useful, it doesn't benefit
at all from running in protected mode, and some of the program is no doubt
simply dead weight. When you write longer programs, though, they will not
increase in size so quickly; most of your code at present is one-off
information that is included in every executable.
Bottom line: If you want to improve the library_code:program_code ratio of
your programs, write more program code and stop worrying about it :)
Also, you might like to get hold of a copy of DJP, the executable file
compresser for djgpp programs. It's in a zip calls mlp???b.zip somewhere on
the FTP sites (sorry, I can't give an exact reference ATM; no doubt the FAQ
points to it).
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
- Raw text -