delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/19/20:42:27

Subject: Re: newbie question
To: chendi AT math DOT umbc DOT edu (Chendi Zhang)
Date: Fri, 19 Aug 1994 17:39:46 -0600 (CDT)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
From: mcastle AT umr DOT edu (Mike Castle)

Amazingly enough Chendi Zhang said:
> 
> Whenever I compile a VERY small program like:
> 
> #include <stdio.h>
> main()
> {
> printf("Hello");
> }
> 
> , The output by djgpp is about 30-35k.  I read somewhere that it has 
> something to do with a -g switch.  How do I make my progs smaller?

-g includes deubgging info, and makes the executable larger (lots
of plain text there).  Try the -s option, or run 

strip a.out

where a.out is the executable.

Btw, printf() is a large function, and so any program that
includes a call to that function will have a certain minimal
size, no matter what you do.  Try using puts() instead and see if
it makes a smaller program.

-- 
Mike Castle .-=NEXUS=-.  Life is like a clock:  You can work constantly
  mcastle AT cs DOT umr DOT edu     and be right all the time, or not work at all
   mcastle AT umr DOT edu       and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

- Raw text -


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