delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/07/00:02:44

From: Arash <ei39594 AT ios DOT chalmers DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How can I reduce the compiled executable size?
Date: Sun, 05 Jan 1997 11:17:42 +0100
Organization: Chalmers University of Technology
Lines: 53
Message-ID: <32CF7FC6.F78@ios.chalmers.se>
References: <Pine DOT HPP DOT 3 DOT 95 DOT 970104224707 DOT 1068B-100000 AT helios DOT usq DOT edu DOT au>
NNTP-Posting-Host: sv320111.ios.chalmers.se
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Matthew Kennedy wrote:
> 
> If I start of with a program such as this:
> void main(void)
> {
>   int i;
>   for (i=0; i<5; i++); /* do-nothing */
> }
> ...
> and compile it like this:
>         gcc test.c -o without...
> Then I add one function (to reposition cursor), like this:...
> #include <conio.h>
> void main(void)
> {
>   int i;
>   for (i=0; i<5; i++); /* do-nothing */
>   gotoxy(1,1);
> }
> ...
>         gcc test.c -o with 
> Now, it I compare the file sizes of with.exe and without.exe, 
>  1-04-97  22:46         100,205  with.exe
>  1-04-97  22:47          61,446  without.exe

Hmmm ....a wild guess is that DJGPP makes the function inline and then 
unrulls the loop, (make five copies of gotoxy()) but does it make the 
executable 40Kb larger???
I assume that DJGPP's version of gotoxy() is a very complex function 
(????) but it should NOT be inline if it's so big!

Try this:
1 Disassemble your code (both version) and send them up to this 
newsgroup. 

2. Take a good look at the gotoxy() function, source is available on the 
net.

3. Strip the symbols, run strip (or whatever it's called),
i think you can do this from compilers command-line too.


BTW, the whole conio will not be linked to your exe-file.


-- Arash
   _____                            |\/\/\/|     
  /     \      _____________        |      |      _______________
\/\/     |    | diz sux...  \       |      |     |  way too much |
 |  (c)(c)    | ..he he cool|       | (o)(o)     |  MTV dad!     |
 C   .---_)   |  __________/        S      _)    \   ____________|
  | |.___|   /  /                   | ,___|    __/  /
  |  \__/   <__/                    |    /    <____/

- Raw text -


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