www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/31/12:46:25

From: "David May" <dmay AT tvi DOT cc DOT nm DOT us>
Organization: Albuquerque T-VI
To: jkapleau AT openix DOT com (Jonathan Kapleau)
Date: Fri, 31 Jan 1997 10:31:53 -0700
Subject: Re: DJGPP v. gcc
CC: djgpp AT delorie DOT com
Message-ID: <19376345A6E@tvi_mail.tvi.cc.nm.us>

> Maybe this is a stupid question, but how come when I compile a simple
> program (i.e. "Hello, World!") using DJGPP on my pc using only the
> <stdio.h> header file it compiles to something like 80k, but when I
> compile it using gcc under Linux the same program compiles to about 4k.
> What gives?

1.  The size of the .EXE is bloated because debugging information is 
included in it.  If you remove the debugging, you get a much smaller 
file.

2. The startup code does a *LOT* of work to set up for a 32-bit flat 
memory model and glob the command-line.  In a silly "Hello, World" 
program, all of this is fluff.  The FAQ describes in detail how to 
remove this functionality if it is unnecessary.  The tradeoff in 
large binaries for small programs pays off when your project is 
large, because you don't have to code for the added start-up 
functionality and the memory provision.

3. ***ALL*** of the library routines that your .EXE file uses are 
placed in the .EXE by the linker.  In Linux, the system provides 
dynamic libraries which are used at run-time and don't get put into 
the binaries.  Also, the shell in Linux globs the command line for 
you (typically) so you don't have to have that functionality in the 
startup code of your program.

The things you can do to minimize this "bloat" have been 
discussed numerous times and are in the FAQ.
David May, ID Card Administrator
Albuquerque TVI

- Raw text -


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