www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/12/06:45:13

Xref: news2.mv.net comp.os.msdos.djgpp:7103
From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP's .exe's are TOO large
Date: Sun, 11 Aug 1996 11:55:25 -0700
Organization: Three pounds of chaos and a pinch of salt
Lines: 56
Message-ID: <320E2C9D.6E63@cs.com>
References: <4uk6qr$795 AT utdallas DOT edu>
NNTP-Posting-Host: ppp204.cs.com
Mime-Version: 1.0
To: lafitte AT utdallas DOT edu
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

lafitte AT utdallas DOT edu wrote:
> 
>      The program :
> main() {
> 
> }
> compiles to something like 30 or 40k!  What gives.  If you then use just
> a couple library functions your code size goes up to around 50 or 60k.
> Am I setting the program up wrong or what?  Do the programs really need
> that huge "library chunk" of data to run?  I can put up with the slow
> compile time, but I make up a lot of little apps, and it just seems that
> they're taking up a heck of a lot more disk space then they need be.
> Just wondering... Please mail replies to lafitte AT utdallas DOT edu
> 
> Rei

What you are seeing is the startup code for DJGPP v2 which includes support
for, among other things, command-line globbing, environment loading, and FPU
emulation, not to mention the DPMI loader.  Also, if you compile without -s,
your program includes symbol information used in debugging.  Section 8.15
of the FAQ (available as v2/faq201b.zip from any SimTel mirror) gives a
detailed description of this and also gives instructions on how to reduce
the size of your executables (to as little as 18K for a "Hello World").

Please also note that, as has been discussed before, "Hello World" is NOT
a realistic test case to determine the size of a program.  The startup
code is a fixed size, and while it does bloat small programs, it is a
trivial part of large ones.  In general, DJGPP code compiles smaller and
faster than almost any other 32-bit compiler.

FYI, here's a brief summary of the instructions in the FAQ.  To reduce the
final size of a DJGPP compiled program, you can do any or all of the
following:

1) Compile your code with -s to strip debugging information.  Alternatively,
run 'strip' on your compiled object code, then relink.

2) #include <crt0.h> in your program and define empty versions of any or all
of the functions __crt0_glob_function, __crt0_setup_arguments, and
__crt0_load_environment_file.  Note that this will DISABLE the corresponding
functionality from your program.

3) Compress your executables with DJP, the DJGPP executable packer.  Pointers
to it are in the FAQ.

HTH!

-- 
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>+ W+>++ N++ o+ K? w(---) O-
M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+ tv+() b+++ DI++ D++ G e(*)>++++
h!() !r !y+()
------END GEEK CODE BLOCK------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019