Mail Archives: djgpp/1997/10/27/20:14:49
At 03:22 10/27/1997 +0000, Manuel Chagas wrote:
>Hi all!
>
>Is there a way to "smart-link" libraries in your exe file? Because
>everytime I link stdio.h, or any other lib as a matter of fact, the exe
>file gets pretty large. Since I'm using just a few functions, I'd like to
>know how to link *ONLY* the functions I'm calling.
First, a slight correction. stdio.h and the other .h files are headers which
are physically included into your source. They contain #defines and
prototypes for the functions. The actual code is all contained in libc.a,
the C library.
Next: What you describe as `smart-link' is already happening. The libc
library is composed of quite a few .o object files, with about one function
in each. The linker picks only the ones you use, and the internal functions
used by them. So if you never use (for instance) `qsort', you won't get its
code.
Probably what makes your EXE so large is startup code. It takes quite a lot
of code to switch to protected mode, expand wildcards on the command line,
load the DJGPP.ENV file, etc, etc. Also, by default debugging information is
included in your EXE. You can find ways to shrink your executables in FAQ
section 8.15.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -