Related articles |
---|
How do linkers work? dwilson@ttl.ie (Dave Wilson) (1999-10-21) |
Re: How do linkers work? tgakem@pebbles.chem.tue.nl (1999-10-21) |
Re: How do linkers work? adonovan@imerge.co.uk (Alan Donovan) (1999-10-21) |
Re: How do linkers work? johnmce@texas.net (1999-10-21) |
Re: How do linkers work? tgakem@pebbles.chem.tue.nl (1999-10-21) |
Re: How do linkers work? strohm@airmail.net (1999-10-27) |
From: | "Dave Wilson" <dwilson@ttl.ie> |
Newsgroups: | comp.unix.programmer,comp.compilers |
Date: | 21 Oct 1999 00:47:29 -0400 |
Organization: | TTL |
Keywords: | linker, question, comment |
Hi,
I have a slight problem.
Consider a static library containing several functions. Some of the
functions in the library (e.g. Fred()) are contained entirely within
the library, whereas others (e.g. Bill()) call functions outside the
library.
Now it makes sense that programs that use the library and call Bill() need
to defined the functions that Bill() calls before a successful link.
However, much to my dismay, programs that only use Fred() from the
library also need to define the functions that Bill() needs __even
though this code is never executed!__.
Forgive me if I'm displaying a certain ignorance about current linker
technology, but I thought linkers could figure out certain things like
which functions will never get called and leave them out.
All comments welcome.
Regards,
---------------------------------------------------
David Wilson, TTL.
[With shared libraries, the linker does indeed tend to drag in the whole
library even when you only need one routine from it. Your moderator
shamelessly suggests you consult "Linkers and Loaders", just published
by Morgan-Kauffman. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.