Boost logo

Boost Users :

From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2008-07-12 04:44:21


John Femiani wrote:
> Rolad Schwarz wrote:
>> Do you encounter a specific problem besides something being
>> different than expected?
>
> There is a problem, because -lboost_xyz links with the dll import
> library boost_xyz.lib instead of libboost_xyz.lib. Sure, there is a way
> around it, but it requires an extra change to build on windows. It is a
> headache and I wish boost would compile the mingw libraries with a .a
> extension. It is particularly tricky to work around this one if you use
> SCons as a build system, since it incorrectly tries to demangle the
> library names,

Yes this is because you are instructing to link with the dynamic lib!
This is default behaviour. Btw. this is the same on *nix (with gnu ld).
If you have both a *.so and a lib*.a the dynamic will be linked in.

You will need to specify -llibboost_xyz to get the static lib, and
-lboost_xyz to get the dynamic.

Below is the behaviour of the gnu ld:

> # gnu ld has the ability to change the search behaviour for libraries
> # referenced by -l switch. These modifiers are -Bstatic and -Bdynamic
> # and change search for -l switches that follow them. The following list
> # shows the tried variants.
> # The search stops at the first variant that has a match.
> # *nix: -Bstatic -lxxx
> # libxxx.a
> #
> # *nix: -Bdynamic -lxxx
> # libxxx.so
> # libxxx.a
> #
> # windows (mingw,cygwin) -Bstatic -lxxx
> # libxxx.a
> # xxx.lib
> #
> # windows (mingw,cygwin) -Bdynamic -lxxx
> # libxxx.dll.a
> # xxx.dll.a
> # libxxx.a
> # xxx.lib
> # cygxxx.dll (*)
> # libxxx.dll
> # xxx.dll
> # libxxx.a
> #
> # (*) This is for cygwin
> # Please note that -Bstatic and -Bdynamic are not a guarantee that a
> # static or dynamic lib indeed gets linked in. The switches only change
> # search patterns!

You can see that by making proper use of the -Bstatic and -Bdynamic
switches you can choose which lib variant you want. (And if you are
using boost-build this is automatic).
Note it was not possible to specifically instruct a build to use either
the dynamic or static variant of a lib. The current naming scheme is
the only that
1) name compatibility with other windows linkers
2) allows static _and_ dynamic links to be specified.

If you request a different naming scheme, please explicitely show how
the above two points can be fulfilled.

Btw.: If you are using boost-build to build your application, there is
an easy way to link against boost libraries: boost.jam

-- 
_________________________________________
  _  _  | Roland Schwarz
 |_)(_  | aka. speedsnail
 | \__) | mailto:roland.schwarz_at_[hidden]
________| http://www.blackspace.at

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net