Sender: root AT delorie DOT com Message-ID: <37E01676.D74EEBDC@pmail.net> Date: Wed, 15 Sep 1999 23:58:14 +0200 From: Fredrick Backman X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com, Snowman Subject: e: Why the executables r so big ???? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Snowman wrote: > HELP HELP > Im using DJGPP. :-) [good thing this isn't rec.cooking.vegetarians then] > And I don't understand while the files that I compile are so big . > When I compile for example this small source code > (about 40bytes): > > main() > { > printf("Hello"); > return 0; > } > > The exe file is over 100Kb Big . Why ???? > (I'm not using the Allegro libary or anything) > > When I look at some other peoples programms > examp.:" DosArena." > Its just about 200Kb > and The source code was really long. > I also made a simple game (using Allegro), > and the exe-file is over 700Kb heavy. > The following is taken from the DJGPP FAQ (Frequently Asked Questions): 8.13 Why are DJGPP `.exe' files so large? ========================================= **Q*: I compiled a trivial "Hello world" program and got a 80KB executable file. That's ridiculously bloated!* **Q*: I switched to GCC 2.8.1, and my C++ executables are considerably larger than when compiled with GCC 2.7.2.1!* *A*: Did you link with `-s' switch to `gcc', or run `strip' on the output of the linker? If not, the executable includes the debugging symbols, which makes it quite a lot larger. (It is not recommended to strip the symbols except when distributing production programs, because this makes debugging very hard indeed; that is why `-s' is not passed to gcc by default.) [End of snipper from FAQ] I think the Allegro FAQ has some suggestions on how to optimize the code to make the executable smaller. You may also want to look at executable compression (.EXE packers) which I never use myself but I think there's a few of them which work okay. Keep in mind though that the difference in _performance_ may not improve very much if you make the .exe file smaller, IMHO the main reason to go through this is (a) to make the download .ZIP file smaller and (b) it's cool to have a 235kb exe rather than 700. Cheers Fred -- Fred Backman Lead Wizard Binary Spells www.binaryspells.com -=-=- Check out our latest space arcade game: AntiTron v0.93b! -=-=-