Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2003-03-03 03:19:59

"klapshin wrote:
> --- In jamboost_at_[hidden], Vladimir Prus <ghost_at_c...> wrote:
> > Regarding the other issue, linking a library into a library, I'll
> > have to do some more research. In particular:
> > 1. Is it possible to link two static libraries together with GNU ar
> Can't tell from a top of my head, but my understanding that you can
> not do that. You should be able to extract object files from two
> libraries and assemble a new one, but I guess it is not what you are
> asking.

Yes, that's pretty contrived approach.

> > 2. Is there are way to link shared library into static one (seems
> > impossible to me).
> I would be surprised if you can do this.
> AFAIK, static library should not be linked with anything, all the
> symbol resolution happens when you link executable or dll.

My understanding too.

> 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

1. Restrict the library to being dynamic. For example

lib a : a.cpp other_lib : <link>shared ;


shared_lib a : a.cpp other_lib ;

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.

Do you agree to my analysis? Or there's a third approach?

- Volodya


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at