Boost logo

Boost Users :

From: Johnson, Donald W MVK Contractor (Donald.W.Johnson_at_[hidden])
Date: 2005-04-27 11:46:06


It seem that due to sheer luck mixing the runtimes was not causing problems.
Objects allocated in the dll where always deleted in the dll and objects
allocated in the application likewise deallocated in the application. I know
because I had forced things to work using BOOST_FILESYSTEM_NO_LIB and
manually linking to the library, and the application worked and all the tests
ran fine. The application was linked to /MT or /MTd so that was a disaster
waiting to happen the first time I called a function across dll with a
dynamicly allocated argument that was held and eventually dealocated on the
dll side. I was being saved because that particular situation never occurs.
Thanks for the help I thought the error message was refering to the runtime
that boost itself was linking against, so was trying to find how to make
boost link against the dynamic library.

Thanks
Donald J

-----Original Message-----
From: John Maddock [mailto:john_at_[hidden]]
Sent: Wednesday, April 27, 2005 4:44 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Problems with boost::filesystem::path continued

>I found the main problem, I had edited the wrong boost/config/user.hpp
>file.
> When I set BOOST_FILESYSTEM_DYN_LINK in the correct user.hpp file I
>get this error.
>
> c:\Boost\include\boost-1_31\boost\config\auto_link.hpp(269): fatal
> error
> C1189: #error : "Mixing a dll boost library with a static runtime is
> a really bad idea..."
>
> #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
>
> So wher am I supposed to set the _DLL symbol or do I need to disable
> auto_link. If so how?

The message tells you what you've done wrong: you can not use a dll that
passes C++ objects between itself and your application unless you are also
using a dll runtime library. If you do manage to do this your code will very
likely crash and burn at runtime (due to recourses being allocated and freed
by differing C++ runtimes). If you switch your code generation options (in
the VC++ IDE) to use a dll runtime then the error message will go away.

John.


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