> But CW evidently does not
> do so, instead determining the contents of the executable as the
> transitive closure of a dependency tree rooted in the main
> function, in the way that traditional linkers handle
> libraries. Even more surprising is the evident fact that the CW
> linker is not even limited to just including or excluding a whole
> code module -- it will include some *functions* out of a code
> module and leave out others, if there are no references to them.
>
> ...
>
> Strictly speaking, it is not correct for a C++ linker to use this
> sort of heuristic: the programmer should be able to specify that
> a particular module is to be included, exactly *because* he needs
> the side-effects of a static initializer in that module.
I'm not sure that there are any standards or rules on whether or not modules
should be accepted as a whole or not. I know that the MPW linkers don't. I
know that VC++ does, and it really pisses me off.
However, if what you say about CodeWarrior is true, then I think that
CodeWarrior is incorrect in how it trims the link tree. Not only should it
include all references reached by main(), but it should also include
unreferenced static global objects with constructors, precisely because
executing their constructors could have needed and unobvious side-effects. When
I worked in Macintosh Developer Technical Support lo many years back, I remember
escalating just such a bug in CFront. So I'm kind of surprised that it appears
in CodeWarrior 11 years later.
-- Keith Rollin
-- Palm OS Emulator engineer
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html