delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/31/15:19:29

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Optimizing target size
Date: Sun, 31 Aug 1997 01:59:58 +0100
Organization: None
Distribution: world
Message-ID: <c5cUqQAOIMC0Ew4a@talula.demon.co.uk>
References: <3403E027 DOT 670 AT xl DOT ca>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 26
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Darren Grant writes:
>I have written a C command-line util that links the Allegro library with
>a very small amount of my own code.  The target executable (in ms-dos)
>is huge!  (just under 300k)  What can I do to reduce the size of this?
>Is the entire Allegro library being linked?  (I'm only using a very
>small part of it)

Allegro doesn't do very well in terms of leaving out unused code, mainly
because the graphics functions are vectored through a table of function
pointers, which means they all end up in your executable regardless of
how many of them you actually use. I think that's a worthwhile sacrifice
to make in exchange for the speed and flexibility the vtables provide,
but it certainly doesn't help with executable sizes. On the other hand,
that 300k won't go up very much as your program gets bigger. It may seem
like a lot to start with, but in a program of any complexity it isn't
raelly such a huge overhead...

Apart from the executable size issues discussed in the djgpp FAQ
(stripping symbol tables and using DJP), you might want to try removing
any unused graphics and sound drivers from Allegro, by editing the
tables at the top of graphics.c and sound.c...


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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