Boost Users :
Subject: Re: [Boost-users] Auto-Linking in Visual Studio 2008
From: John Drescher (drescherjm_at_[hidden])
Date: 2012-01-05 16:23:04
On Thu, Jan 5, 2012 at 3:55 PM, Robert Abel <abel_at_[hidden]> wrote:
> Hi John,
> On 2012/01/04 12:58, John Maddock wrote:
>> Are the dynamic libraries being specified on the linker command line?
> No, the dynamic libraries are not. The import libraries are, however.
>> You absolutely should not be linking to both (ie both auto-linking and
>> specifying the lib's on the command line).
> Ok, got that. This was why I was asking, because the CMake script I
> currently use do this. Probably because the makers use mingw, where the
> website states auto-linking doesn't work... So the authors might be
> unaware of the problem.
>> So either disable auto-linking with BOOST_ALL_NO_LIB (you will need to
>> enable dynamic linking as well with BOOST_ALL_DYN_LINK if you want to
>> use the DLL's), or remove the library dependencies in CMake and let
>> the auto-linking do it's work.
> I already did the former. Basically, I'm pulling in dependencies from
> some other library which depends on boost. So when I include its
> required libraries in my CMake script, the variable will contain boost
> as well...
>> If you take the former route, be *very* careful that your build script
>> picks the correct lib variant, otherwise you're likely to see crashes
>> and other strange hard to track down behavior.....
> I'm wondering about this one. Basically, my situation is like this:
> I have debug and release builds of dynamic and import boost libs. I
> built the intermediate library (the one from above) using release. Now,
> when I compile my own project for debug, the executable will crash
> (within a function of the intermediate library). However, when I compile
> my project for release, everything goes smoothly.
> Would this be the kind of situation you mentioned above?
Yes. Microsoft Debug CRT is not compatible with the Release CRT so you
can not safely mix debug and release dlls and exes.
> Because I'm not
> quite sure where this problem would be coming from, seeing as the
> executables only require the correct libraries, i.e. my debug executable
> will use boost debug libraries, and release libraries of my other
> dependent library. Whereas release will require release boost libs and
> release dependency... The exception I encounter in debug is actually
> boost::thread::interrupted_exception, IIRC.
> Boost-users mailing list
-- John M. Drescher
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