From: "Don Berkley" Subject: Re: How Come the Executable Files are SO Large? Newsgroups: comp.os.msdos.djgpp References: <01bc51ee$55eb94e0$030101c0 AT ibm DOT ibm DOT net> <33608B9F DOT 5D56 AT SPAMcs DOT com> Message-ID: <01bc527f$e8144ce0$030101c0@ibm.ibm.net> NNTP-Posting-Host: 166.72.137.109 Date: 26 Apr 97 20:24:59 GMT Lines: 60 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I am sorry that I did not look in the FAQ first. I was/am in a hurry because I am completing a compiler that I am writing for a college course. It is a very small compiler and must run stand alone. So, I packaged my compiler with pmodstub.exe and tried to run it on a second DOS machine that does not have DJGPP installed on it. I received a message stating that the program was too large for memory and I have 8MB on this machine! I was surprised by this and began looking at the .exe file sizes (at that time). I did not think to look in the FAQ because the .exe file was twice as big as the .exe file compiled under a MSWin C-compiler. I can not hand in a project that requires more than 8MB, so I'll have to hand in the MSWin copy of the .exe file. I did compare the size of the DJGPP .exe file that runs without pmodstub.exe and there is not much difference in size. Oh well, back to MSWin:>( Don Berkley John M. Aldrich wrote in article <33608B9F DOT 5D56 AT SPAMcs DOT com>... > Don Berkley wrote: > > > > Hello, I was very excited to learn about DJGPP and > > installed it on one of my DOS machines. However, > > the executable (.exe) files produced by the compiler > > are roughly twice the size I expect them to be. Am > > I doing something wrong or why are they so big? > > Thanks for any enlightenment! > > This is one of the most frequently asked DJGPP questions. Why do I say > this? The Frequently Asked Questions list (v2/faq210b.zip) gives a > detailed explanation of executable size and what you can do about it in > chapter 8.15. > > Briefly, the vast majority of that extra space is used by the djgpp > startup code, which handles switching into protected mode, setting up > exception handling and long filename support, parsing the command line > arguments, reading the system environment and 'djgpp.env', and more. > There are ways to disable some of this; see the aforementioned section > of the FAQ. > > The thing to remember about the startup code is that it is a fixed > size: the larger the program, the less proportional part of it will be > taken up by the startup code. In fact, for large programs, DJGPP > usually produces code that's smaller and faster than code from any > commercial DOS compiler. With small programs, the time it takes to > perform the startup operations completely obscures the time it takes to > actually run your code. It's a bit silly to do all of that work just to > print "Hello, world." on the screen. ;) > > -- > John M. Aldrich, aka Fighteer I > > -----BEGIN GEEK CODE BLOCK----- > Version: 3.1 > GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>++ W++ N++ o+>++ K? w(---) > O- M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+(++) tv+() b+++ DI++ D++ G>++ > e(*)>++++ h!() !r !y+() > ------END GEEK CODE BLOCK------ >