help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running initial code when in library


From: Paulo Matos
Subject: Re: Running initial code when in library
Date: 24 May 2006 08:27:27 -0700
User-agent: G2/0.2

Paul Pluzhnikov wrote:
>
> GNU-ld specific solution (assuming you really do want all of
> libbf libot and libfm to be included in the executable):
>
> > /bin/sh ../libtool --tag=CXX --mode=link g++  -ggdb -Wall -std=c++98 ...
> > esatcluster.o extsat.o esatlogger.o
>   -Wl,--whole-archive
> > ../lib/bf/src/libbf.la ../lib/ot/src/libot.la ../lib/fm/src/libfm.la
>   -Wl,--no-whole-archive
> > ../lib/glpkinterface/src/libglpkinterface.la
> > ../lib/ncquest/src/libncquest.la  -lm -lnsl -llog4cpp
>

I didn't know the linker was going to search for unused objects and if
not used it would not include them. Nice to know. Thanks also for the
reference to your bookshelf metafore. It's nice! Still I don't
understand why this works this way. This is an example where there are
not specific references to the objects in a given module but they are
needed. They self register and then the core software calls their
methods through the interface which works with polymorphism so it's not
possible to know if something is needed at compile time. Everything is
done through the module interface which is also used to access each
module's (compiled statically) functions through polymorphism... kind I
have no other solution than using --whole-archive to linker right now,
unless there's a specific autotools solution I don't know of which does
this automatically.

Thanks for all your help, and if you have any other suggestion, I'm all
ears! :)

Cheers,

Paulo Matos

> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]