From: Christoph Kukulies Message-Id: <199701041738.SAA25279@gilberto.physik.rwth-aachen.de> Subject: Re: How can I reduce the compiled executable size? In-Reply-To: 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 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit > > 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 > > 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