Re: I'm a stupid blond :( Please help me!!!
From: Peter van Merkerk (merkerk_at_deadspam.com)
Date: 12/05/03
- Next message: Chyi Pin Lim: "value_type of a back_insert_iterator"
- Previous message: Ed Morton: "Re: OT: mindless: Do you have a good name for a class that...?"
- In reply to: Gary Labowitz: "Re: I'm a stupid blond :( Please help me!!!"
- Next in thread: Gary Labowitz: "Re: I'm a stupid blond :( Please help me!!!"
- Reply: Gary Labowitz: "Re: I'm a stupid blond :( Please help me!!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 5 Dec 2003 23:20:12 +0100
"Gary Labowitz" <glabowitz@comcast.net> wrote in message
news:t7udnYO_Z9kXJk2i4p2dnA@comcast.com...
> "Karl Heinz Buchegger" <kbuchegg@gascad.at> wrote in message
> news:3FD05564.8300D296@gascad.at...
> > Peter van Merkerk wrote:
>
> > Also note that with the existence of virtual functions it got much
harder
> > for the linker to figure out if a function is referenced or not.
>
> I'm not sure of this. It wouldn't make sense for a function name that
occurs
> in a program to be left out of the external references table. Unless
linkers
> have changed a lot since I worked on them each function call that is
> unresolved results in an address for that function of zero and a flag (in
a
> table of some sort) indicating that it is an unresolved external
reference.
> The linker's job is to search the libraries it has available and link in
the
> object file that contains the code for that referenced function. If the
> object code of that referenced function also contains code for some other
> number of functions, all that code is linked in whether it is referenced
or
> not. This is what causes bloat.
That doesn't happen with all linkers
> The opposite side of that coin is to make more and more object files with
> less and less functions in them. This leads to library bloat. (It also
makes
> the linkage process take longer.) It's always a trade-off, and you also
want
> to keep functionally related code together for maintenance ease.
>
> I can't recall any system specifically linking in only the code of a
> referenced function from a module that has several functions in it. You
use
> one -- you get them all.
Well for one the linker that comes with Microsoft Visual Studio 6 (not
exactly state-of-the-art) links only the code of referenced functions. It
most certainly does not link the code of all functions in an .obj file,
unless every function in that .obj is referenced. What you are saying may be
true for some linkers but certainly not for all.
> The resulting exe has all the referenced function addresses filled in;
> usually relative to the start of the exe's code. That table that told
where
> the unreferenced function addresses were in the object files now tells
where
> the relative addresses are in the exe. It's the loader's job to adjust
them
> to actual addresses when the exe is loaded. (I believe they are adjusted
to
> virtual addresses nowadays so that the code can be placed anywhere in real
> memory and the machine's virtual addressing mechanism adjusts all
addresses
> to real memory address.)
I won't comment on this part because it is drifting quite far away from the
topic of this newsgroup. But for the record; this explanation is not
necessarilly entirely accurate (what exactly happens depends on the OS).
> Anyway, the way it always worked before: if you reference a function, you
> get the entire object file that contains that function linked in. No way
> out.
There is a way out; use a better linker. If you are interested I can mail
you a MSVC6 project that demonstrates that an object file is only partially
linked in when only a few functions in that object file are referenced.
-- Peter van Merkerk peter.van.merkerk(at)dse.nl
- Next message: Chyi Pin Lim: "value_type of a back_insert_iterator"
- Previous message: Ed Morton: "Re: OT: mindless: Do you have a good name for a class that...?"
- In reply to: Gary Labowitz: "Re: I'm a stupid blond :( Please help me!!!"
- Next in thread: Gary Labowitz: "Re: I'm a stupid blond :( Please help me!!!"
- Reply: Gary Labowitz: "Re: I'm a stupid blond :( Please help me!!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|