Boost logo

Boost Users :

Subject: Re: [Boost-users] Linking problem
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-02-26 15:28:59

Lars Viklund wrote:
> On Sun, Feb 26, 2012 at 08:26:32AM -0800, Robert Ramey wrote:
>> Johan R?de wrote:
>>> I built Boost with the command
>>> b2 toolset=msvc-10.0 address-model=32 link=static
>>> runtime-link=shared threading=multi stage
>>> I'm linking statically with Boost and dynamically with the CRT
>>> (compiler option /MD).
>> I think this is a problem. At one time attempting to do this
>> provoked an error message "... is really a bad idea". This is
>> because that portions of the CRT library would show up in
>> both the DLL (static link of library) and the application itself
>> which uses the DLL. For certain CRT functions which have
>> side effects this would be a problem. There might be some
>> other problems as well which I don't know about.
> It's the other way around that's the scary way.

This is what I meant

> That is, using a static CRT in a dynamic library, as you then have
> disjoint instances of the CRT in both the application and the dynamic
> module, leading to split views of things like the free store, file
> handles, etc. The net effect of doing it the scary way is that you
> cannot share pretty much anything standard-library-like across the
> border.
> Statically linking a library that uses a dynamic runtime is perfectly
> sane.

I guess I'm confused about building boost with

link=static runtime-link=shared

which I take to mean that the library is created as a DLL
(runtime-link=shared) but linked as a static (link=static)
which would include some functions in the CRT twice
- once inside the DLL and again when the the library
which uses the DLL refers to the same function.
I'm guessing that boost build won't build a DLL
with a static linked CRT for just this reason.

I concede I'm confused about this.

>>> LINK : fatal error LNK1104: cannot open file
>>> 'libboost_iostreams-vc100-mt-1_49.lib'

>>> What might the problem be?
> Does this file exist in your library search path?
> Ensure that the headers you use (1.49.0, it seems) match the libraries
> you've got.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at