Boost Users :
Subject: Re: [Boost-users] Why "Mixing a dll boost library with a static runtimeis a really bad idea..."?
From: John Maddock (john_at_[hidden])
Date: 2009-03-13 13:05:07
> I want (need) to use boost libs as dll with a static run-time library. In
> this case auto_link.hpp gives me an error "Mixing a dll boost library with
> static runtime is a really bad idea...". Why is it a bad idea? I don't
> that it's a good idea but requirements in our project demand
> linkage for all modules and they don't want to use regex as static library
> cause of it's size. What problems could it cause? I know only one problem
> with a memory allocation in different modules. Any more?
It absolutely *will* cause your program to crash if you do that: the dll and
the application will have different runtime libraries, different memory
allocators etc. The only way you *might* get away with it, is if all the
API's you call are extern "C" functions, so that you can guarantee that no
memory is ever allocated in one and freed in the other module - that's
something you can't achieve with C++ API's because you don't know what will
be expanded inline and in which module.
BTW, Boost.Regex adds about 50K to an application when statically linked,
that's a lot less than the dll adds!
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