delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/08/12:44:09

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How can I reduce the compiled executable size?
Date: Tue, 07 Jan 1997 22:06:37 -0800
Organization: Two pounds of chaos and a pinch of salt
Lines: 47
Message-ID: <32D3396D.4D2C@cs.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 970107084724 DOT 26754H-100000 AT is> <32D2F60F DOT 248A AT pluto DOT njcc DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp108.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

shearer AT pluto DOT njcc DOT com wrote:
> 
> forget about the cornio's addition of approx. 40k...
> ...what makes an executable (which does nothing!),,,
> ...over 61k???
> C is supposed to be the next best thing to ASM!!!...
> but this is laughable...
> 
> what gives?

Please take the time to find things out before tossing baseless
accusations.  DJGPP is a 32-bit DPMI compiler, and as such has a great
deal of overhead involved in its code, which includes the following
things and more:

  Starting up protected mode and loading a DPMI host if necessary.
  All the exception handling and PM<->RM mode switching code.
  Recognizing and processing DJGPP-style long command lines.
  POSIX-style wildcard expansion (globbing).
  Reading the DJGPP environment from 'djgpp.env'.
  Long filename support.

  Debugging information.  (*)

There are more, but this is a fairly comprehensive list.  The catch is
that all of these things are a FIXED size.  The larger the program, the
smaller this overhead becomes relative to the total size.  For large
projects, DJGPP compiles code that is significantly smaller than any
other 32-bit compiler in existence.  This becomes especially noticeable
when you compile with optimizations.

For small projects, there are ways to remove parts of the startup code
that you don't need.  Please read the DJGPP FAQ (v2/faq202b.zip),
chapter 8.15, for full details.

(*) The size of debugging information is relative to the size of your
code, naturally, but I include it here because it is part of the
overhead.  To remove this information (which will make your program
impossible to debug), compile with the '-s' parameter, or run 'strip' on
the compiled code.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I  |        fighteer AT cs DOT com         |
| Plan:  To find ANYONE willing to |   http://www.cs.com/fighteer   |
| play Descent 2 on DWANGO!        | Tagline: <this space for rent> |
---------------------------------------------------------------------

- Raw text -


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