Karl Heinz Buchegger wrote:[color=blue]
>
dave.harper@gmail.com wrote:[color=green]
> >
> > I started learning C++ a few days ago, and I've run into a couple
> > questions regarding what is included in the executable when the source
> > is compiled... I've written a simple, 1-D rocket predicting program
> > that's under 2K prior to compiling, but about 540k after compiling.[/color]
>
> The executable not only contains the translated program but lots of other
> things.
> Most prominent is the runtime library. If you do output to the console then
> obviously there must be some code that does exactly that: handling output.
> If you do math, then obviously all the math functions need to be implemented
> somewhere. All of this is in the runtime library. Depending on the actual linker
> it might link in all of the runtime library or just the parts that are really
> needed by your program.
>
> Another thing that might be in your final executable is the debugger information.
> A debugger is a program which can control your program during execution. This way
> it is possible to inspect your program while it runs. You can watch variables as
> they change, set breakpoints (the debugger interrupts the program when it reaches
> a specific point) and lots more. Debugger information is not cheap. The executable
> needs to hold information which executable code parts correspond to which source
> code part, what variable names where there in the beginning, which type did they
> have, etc. Everything that is needed to bridge the gap between pure machine
> code and your high level language source code.
>
> With a size of 540K I would guess that both things happend: You have debugger
> information in your executable and the runtime is linked in.
>
> --
> Karl Heinz Buchegger
>
kbuchegg@gascad.at[/color]
Karl,
Thanks for the info. I turned off the debugger info, and it knocked
off 100k (down to 420k or so). I haven't been able to find out how to
unlink unused parts of the runtime library. I'm using Bloodshed
Dev-C++, and I've poked around all the options, but haven't seen it
yet. I'm not sure it's an option since it's freeware...?
Thanks!
Dave