www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/04/12:38:04

From: Christoph Kukulies <kuku AT gilberto DOT physik DOT rwth-aachen DOT de>
Message-Id: <199701041738.SAA25279@gilberto.physik.rwth-aachen.de>
Subject: Re: How can I reduce the compiled executable size?
In-Reply-To: <Pine.HPP.3.95.970104224707.1068B-100000@helios.usq.edu.au> from Matthew Kennedy at "Jan 4, 97 10:58:56 pm"
To: q9522772 AT helios DOT usq DOT edu DOT au (Matthew Kennedy)
Date: Sat, 4 Jan 1997 18:38:43 +0100 (MET)
Cc: djgpp AT delorie DOT com
Reply-To: Christoph Kukulies <kuku AT gilberto DOT physik DOT rwth-aachen DOT de>
MIME-Version: 1.0

> 
> If I start of with a program such as this:
> 
> /**test.c***********/
> 
> 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:
> 
> /**test.c***********/
> 
> #include <conio.h>
> 
> void main(void)
> {
>   int i;
> 
>   for (i=0; i<5; i++); /* do-nothing */
>   gotoxy(1,1);
> }
> 
> /*******************/
> 
> and use the following compile sequence,
> 
> 	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
> 
> 
> POINT!!!: Why does the addition of gotoxy(1,1) add 40k of code the the
> size of the executable??  In assembler such an addition would be about 10
> bytes!

Do you mean a DOS int that is doing a gotoxy() ? Since gotoxy is a
C library function (I assume) it's code is linked to your executable
and thus grows the executable accordingly. If you knew the asm
code for this you might #define gotoxy as an inline asm code
and keep your executable small.


> 
> How can I stop the whole conio (I assume) library from being linked in????
> 
> Thankyou.
> 
> Matthew
> 
> 
> 

--Chris Christoph P. U. Kukulies kuku AT gil DOT physik DOT rwth-aachen DOT de

- Raw text -


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