From: aho450s AT nic DOT smsu DOT edu (Tony O'Bryan) Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP compiler question (extreme newbie) Date: Thu, 15 May 1997 21:57:16 GMT Organization: Southwest Missouri State University Lines: 28 Message-ID: <337b8454.870629@ursa.smsu.edu> References: <337b72a6 DOT 111607 AT news DOT frontiercomm DOT net> NNTP-Posting-Host: forseti.i58.smsu.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Thu, 15 May 1997 20:40:48 GMT, lbrown AT frontiercomm DOT net (L. Brown) wrote: >This command compiled the program and it ran fine, but the file was >90176 bytes long. I tried to compile several other test programs of >different lengths and they always come out to be 90176 bytes long. There are several things to consider about gcc (and protected mode in general): 1) Unless overridden, constants, jump addresses, etc are 4 bytes long (twice as large as real mode). This will add a little to the size of your program. Not much, but we're counting bytes here. :) 2) gcc inserts a lot of overhead into the compiled program. Either add the -s (note that this is way different from -S) switch to the command line, or run strip.exe on the final executable. This will dramatically reduce the size of the .EXE. Mythos (a game I'm developing) compiles to amost 600K. After running strip, to remove the debugging information, it goes down to 275,968 bytes. Debugging information is over half the .EXE. 3) gcc adds significantly more overhead to do such things as get the machine into protected mode, check for a (and load if necessary) DPMI server, parse long command lines, and other things. All this startup code gets put into your final executable. As your programs get larger, the startup code takes a smaller percentage of your EXE bytes. Protected mode is meant for large programs. Writing small programs will waste system resources in protected mode. DJGPP is a very good compiler. If you need the power of protected mode, stick with DJGPP.