VC++ 7.1 build options lead to AV

Dear Boost, The following call stack leads to an access violation when I link a VC 7.1 DLL to the release build of the boost signals 1_33_0 DLL. In comparison, there is no access violation when I link to the debug build of the same library. Similarly, when I add the signals source to my own release DLL, there is no access violation. I attempted to disable all compiler optimizations in msvc.jam as follows. However, after running bjam -a in signals\build and installing the output, the AV still occurs. # 8.0 deprecates some of the options if ! [ MATCH ^([67].*) : $(version) ] { # flags msvc.compile CFLAGS $(condition)/<optimization>speed : /O2 ; # flags msvc.compile CFLAGS $(condition)/<optimization>space : /O1 ; flags msvc.link.dll MANIFEST : "mt -manifest " ; flags msvc.link.dll OUTPUTRESOURCE : "-outputresource:" ; } else { # flags msvc.compile CFLAGS $(condition)/<optimization>speed : /Ogity /O2 /Gs ; # flags msvc.compile CFLAGS $(condition)/<optimization>space : /Ogisy /O1 /Gs ; } Note that I have a default installation of Visual Studio 2003. How can I alter the release build to avoid the access violation? More information: Access violation reading location 0x00000004 (*((k2).content)).__vfptr is 0x00000000 bool operator()(const any& k1, const any& k2) const { if (k1.type() == typeid(front_type)) return !(k2.type() == typeid(front_type)); if (k1.type() == typeid(back_type)) return false;
if (k2.type() == typeid(front_type)) return false; if (k2.type() == typeid(back_type)) return true;
Colorado.dll!boost::signals::detail::any_bridge_compare<std::less<int>,int>::operator()(const boost::any & k1={...}, const boost::any & k2={...}) Line 54 + 0xc C++ Colorado.dll!boost::detail::function::function_obj_invoker2<boost::signals::detail::any_bridge_compare<std::less<int>,int>,bool,boost::any,boost::any>::invoke(boost::detail::function::any_pointer function_obj_ptr={...}, boost::any a0={...}, boost::any a1={...}) Line 119 + 0x1b C++ boost_signals-vc71-mt-1_33.dll!010a2340() boost_signals-vc71-mt-1_33.dll!010a2c6a() boost_signals-vc71-mt-1_33.dll!010a42be() boost_signals-vc71-mt-1_33.dll!010a4bd0() boost_signals-vc71-mt-1_33.dll!010a4dfc() boost_signals-vc71-mt-1_33.dll!010a5933() Colorado.dll!boost::signal0<bool,boost::last_value<bool>,int,std::less<int>,boost::function<bool __stdcall(void),std::allocator<void> > >::signal0<bool,boost::last_value<bool>,int,std::less<int>,boost::function<bool __stdcall(void),std::allocator<void> > >(const boost::last_value<bool> & c={...}, const std::less<int> & comp={...}) Line 198 + 0x85 C++ ...
Do these observations suggest how I might successfully handle this callback from the release boost DLL? Thanks in advance, - Ashok Thirumurthi

Ashok Thirumurthi wrote:
Dear Boost,
The following call stack leads to an access violation when I link a VC 7.1 DLL to the release build of the boost signals 1_33_0 DLL. In comparison, there is no access violation when I link to the debug build of the same library. Similarly, when I add the signals source to my own release DLL, there is no access violation. I attempted to disable all compiler optimizations in msvc.jam as follows. However, after running bjam -a in signals\build and installing the output, the AV still occurs.
You were commenting out BBv2 code. Boost.Signals is being build with BBv1 (if you were building it from the boost root), use "bjam -a --v2" to build with BBv2. Also, you can use: bjam -a --v2 optimization=off to turn off the optimization?
How can I alter the release build to avoid the access violation?
Access violation reading location 0x00000004 (*((k2).content)).__vfptr is 0x00000000
bool operator()(const any& k1, const any& k2) const { if (k1.type() == typeid(front_type)) return !(k2.type() == typeid(front_type)); if (k1.type() == typeid(back_type)) return false;
if (k2.type() == typeid(front_type))
This looks to be an issue with either Boost.Any or your code. What is any::type() returning? Have you made sure that RTTI is enabled for everything (including your own project -- is there a difference in the vcproj Configurations?) Are you doing something in the Debug version that is not in the Release version? Are you linking with the right variant of the boost libraries? Is there a conflict with the run-time library being used? - Reece
participants (2)
-
Ashok Thirumurthi
-
Reece Dunn