Does this mean I can't store member functions of the same class across several libraries?
I was hoping to avoid polymorphism for delayed implementation of a member function. Since only one instance of the member function is needed, polymorphism doesn't seem to be a good solution to this problem. I would like to interchangeably link different implementation of a member function stored in different libraries. Is there a better solution? KC On Wed, 17 Jan 2007 22:44:29 -0800, Paul Pluzhnikov wrote: > Chameleon <[EMAIL PROTECTED]> writes: > >> So the question is why linker include useless binary objects to final >> binary executable. > > Because you told it to do so. > > When you link with > > g++ main.o foo.o bar.o baz.o -laaa -lbbb -lccc > > then linker is *not allowed* to remove foo.o, bar.o and baz.o from > the link [1]. Contrast this with: > > ar ruv libfoobarbaz.a foo.o bar.o baz.o > g++ main.o -lfoobarbaz -laaa -lbbb -lccc > > Now the linker can remove foo.o etc. from the link if they are not > referenced by main.o > > More info here: http://webpages.charter.net/ppluzhnikov/linker.html > > Cheers, > > [1] Some linkers (most notably AIX) ignore what you *explicitly* > told them to do, and do what they think is "right". Quite often what > they think is "right" is actually wrong, and tools that think they > are smarter than the programmer are the first ones to be against > the wall when the revolution comes. _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus