Boost logo

Boost-Build :

From: klapshin <klapshin_at_[hidden] (klapshin_at_[hidden])
Date: 2003-03-03 18:23:38


--- In jamboost_at_[hidden], Vladimir Prus <ghost_at_c...> wrote:
> > The problem here is that dll, from linker point of view, much
closer
> > to exe then to static library. However boost.builds has a generic
> > rule lib which is supposed to handle both.
>
> I'm not sure this is a problem. The real problem is that, as we've
discovered,
> one can link static/dynamic libraries into dynamic library, but
not into
> static library. This means you have only two choices

Yes, that's pretty much what I was trying to say: one can link
libraries into dynamic library, pretty much the same way she can
link them into executable, as opposed to linking static library.

> 1. Restrict the library to being dynamic. For example
>
> lib a : a.cpp other_lib : <link>shared ;
>
> or
>
> shared_lib a : a.cpp other_lib ;

Effectively giving up ability to link library as static or dynamic
for any library having dependencies? This will make the whole idea
of being able to easily link library one way or another pretty much
unusable.

>
> 2. Don't use libraries in sources. I've explained that previously,
and will
> commit an update to documentation soon. In short:
>
> lib a : a.cpp : : : <library>other_lib ;
>
> Now everybody who links to "a" will pick "other_lib" as well.

Wait a second. So since we put other_lib into requirements,
everybody linking to lib "a" will link to "other_lib", even if "a"
is dynamic? That does not sound right. That would be a correct
behavior for static but not dynamic libs.
My understanding is that if "a" is linked as dynamic library it
should get linked against "other_lib", but everybody who uses "a"
should only get linked against "a", not "other_lib". For "a" being
linked as static lib on the other hand, everybody linking to "a"
should also get linked to "other_lib" automatically.

So looks to me that conceptually other_lib is source for dynamic
lib "a" and a requirement for static lib "a".
Don't know how to get around this problem. My preference would be
adding libraries to sources, and then for static libs, removing them
from sources and moving to requirements. Since I know nothing about
boost.build internals I have no idea if it is feasible at all.

- Kirill

 


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk