www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/04/08:53:58

From: Matthew Kennedy <q9522772 AT helios DOT usq DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: How can I reduce the compiled executable size?
Date: Sat, 4 Jan 1997 22:58:56 +1000
Organization: University of Southern Queensland
Lines: 54
Message-ID: <Pine.HPP.3.95.970104224707.1068B-100000@helios.usq.edu.au>
NNTP-Posting-Host: helios.usq.edu.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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!

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

Thankyou.

Matthew


- Raw text -


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