[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cyclic dependencies
Re: Cyclic dependencies
Fri, 13 Jun 2003 10:20:27 -0500 (CDT)
On 13 Jun 2003, Thomas Maier wrote:
> d, e, ... usually use things from a and b, some also from c (when using
> a or b they also depend on c, of course). Solving these inter
> dependency problems could quickly be done by putting a, b and c together
> into one library, but I do not feel good about that because they contain
> classes that do different things (yes, it is C++). Even ripping out the
> low level stuff from a, b and c into some core library doesn't comfort
> me too much, although right now I don't see another option. But maybe
> you can enlighten me a bit about convenience libs.
> a seems like a clear candidate for being a convenience library as it
> contains very and only low level things. But then I wonder if a
> convenience library may be used by several libraries. The libtool doc
Yes, you can use a convenience library for several libraries, but
these libraries can never be used in conjunction with each other since
there would be duplicate symbols due to containing some of the same
> "As a rule of thumb, link a libtool convenience library into at most
> one libtool library, and never into a program [...]"
It would be better for the documentation to specify the "why" and the
"how" and not specify "rules of thumb" which may not actually apply to
> If, say, a as a convenience library gets included (that's the way it's
> handled by libtool, right? I have never used them before) into b and c
> (and d and e and ...), what happens when I link something with b and c?
> And, even before, what happens when I link c with b when building c?
> On the same page "(libtool)Static libraries" the doc also says
> "But be careful not to link a single convenience library, directly or
> indirectly, into a single program or library, otherwise you may get
> errors about symbol redefinitions."
When you use a convenience library, it is the same as adding the
objects from the convenience library to the library being built. In
this sense, a "convenience library" is not really a library at all.
It is simply a handy way to refer to a collection of built objects.
Note that if several libraries "link" with the same convenience
library, then some disk space is wasted since there are several copies
of the convenience library objects in the target libraries.