delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/03/17:53:56

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199607032147.AA116540478@relay1.geis.com>
Date: Wed, 3 Jul 96 21:39:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: EXE size

Reply to message 4236778    from NORBERTJ AT PANI on 07/03/96 10:46AM


>hello world compiles to about 50K .exe.  I wonder why so much...there is
>only a printf function.  Is there any way to get it smaller?

As has been stated many, MANY times before, hello worlds are an
unrealistic test case to determine executable size.  The vast majority
of that 50K is the startup code that DJGPP invokes to, among other things,
load DPMI, read command-line arguments, expand command-line
wildcards, and read the system environment variables.  DJGPP code
itself is quite small for a 32-bit compiler.  The next time you compile,
use -c to make gcc produce only an object (.o) file.  That's the actual
size of your code.  :)

BTW, if you want to disable any of the above features (either because
you don't need them or don't want them), look up the __crt0_* functions
in libc.inf.  For example, I wrote a program that I wanted to accept
command-line arguments verbatim without any globbing or other specialhandling,
so in it I simply put in a blank __crt0_glob_function().  Doing so
will reduce the size of your executable marginally.

John

- Raw text -


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