|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2002-10-15 17:11:32
Alkis Evlogimenos <alkis_at_[hidden]> writes:
> So if I get it correctly:
> runtime-link-static: creates a static library that is statically linked to the
> C++ runtime
No, the use of runtime-link-static is not limited to static library
building. If your Jamfile says:
exe foo : foo.cpp : <runtime-link>static ;
it creates an executable which is always statically linked to the
runtime library. So <runtime-link>static compiles and links objects
which are suitable for linking statically to the runtime.
> runtime-link-dynamic: creates a static library that is dynamically linked to
> the C++ runtime (is this possible?)
Likewise, not specific to static libraries.
> shared-linkable-true: creates a shared library that is dynamically linked to
> the C++ library
No, <shared-linkable>true generates code which can be linked
dynamically. On linux gcc this means it uses -fPIC.
> I am using linux and both runtime-link-dynamic and
> runtime-link-static are static libraries.
Let's just get the terminology straight. They are not static
libraries. They are subvariant path components which correspond to the
build properties <runtime-link>dynamic and <runtime-link>static,
respectively. In that build directory tree you will find a
built product. Depending on the type of main target you've built, it
will be a static or dynamic library, an executable, or a python module.
> They also have the same
> size but the binaries differ (at least this is what diff says).
>
> As an example I dumped the symbols for
> ./libs/thread/build/bin/libboost_thread.a/rs/debug/runtime-link-{static,dynamic}/threading-multi/libboost_thread.a
> and I get the following diff:
Ah, so you're building libboost_thread.
> It looks like only the name mangling differs.
<snip>
> So I assume linking to either
> one will result in an executable that will behave the same. Maybe linux
> doesn't do a distinction between linking dynamically to the C++ runtime or
> not?
Yes, it does. That's what -static in the g++ command-line means. You
can inspect the build command lines by passing
-n -a
to bjam when you invoke it. Inspecting the differences will tell you a
lot.
-- David Abrahams * Boost Consulting dave_at_[hidden] * http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk