|
Boost : |
From: Roland Schwarz (roland.schwarz_at_[hidden])
Date: 2004-12-06 05:44:23
Stefan Slapeta wrote:
>
> There are two restrictions in the thread jamfile I don't understand:
>
> - the thread lib must be built with static runtime libraries
> - the thread dll must be built with dynamic runtime libraries
>
> What is the reason for that? Why can't I use the shared rt and link
> boost.thread statically (and vice versa)???
>
Have a look at the thread on the users list:
Re: [Boost-users] Re: Memory leak reported using threads library
Basically because:
#if (defined(_DLL) || defined(_RTLDLL)) && defined(BOOST_DYN_LINK)
# define BOOST_LIB_PREFIX
#elif defined(BOOST_DYN_LINK)
# error "Mixing a dll boost library with a static runtime is a really
bad idea..."
#else
# define BOOST_LIB_PREFIX "lib"
#endif
and
Peter Dimov wrote:
> It works as long as you don' allocate in one and delete in the other.
> C-style interfaces are fine, but passing a std::string from the EXE to
> the DLL (or vice versa) will fail. shared_ptr will work, though :-)
> unless you unload the DLL that has created it, of course. Deleting an
> object with a virtual destructor works, too.
as the explanation of "bad idea".
But perhaps this reasoning should be mad more explicit. At least as an
extended comment in the autolink file as I already suggested.
Roland
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk