[Serialization] problem linking on Windows using Visual Studio and SCons
I've looked everwhere I know to look (MSDN, SCons archive, Boost archive, etc) and tried tweeking my code every way I know how (and countless other suggestions found Googling), but for some reason I cannot get boost_serialization lib to link into my application. If I build with -DBOOST_SERIALIZATION_NO_LIB, I get LNK2005/LNK2019 errors. MSDN says these are CString related, but their "solution" is only for MFC - which won't work with my setup... I'm using SCons to build my "Custom Makefile" QT application - Visual Studio is basically just an editor for my environment. If I leave off -DBOOST_SERIALIZATION_NO_LIB, I get LNK1104 (can't open Boost Serialization lib file)... even though the path to the Boost Serialization lib is explictily listed on the command line (and it is there)! I think this could have something to do with Microsoft's auto-linking, but I'm not 100% sure. Any pointers would be greatly appreciated. Best wishes, Ben
Hi
Background: 1_33_1
Example : boost_1_33_1\libs\serialization\vc6ide\test_no_rtti
I can run the example successfully on Debug mode with no warning and no
error.
However, it has several warnings, abnormal operation and memory leak when
running on release mode.
The following is the warnings:
d:\barr\serialization\boost\boost_1_33_1_bk\boost\smart_cast.hpp(200):
warning C4541: 'dynamic_cast' used on polymorphic type 'polymorphic_base'
with /GR-; unpredictable behavior may result
d:\barr\serialization\boost\boost_1_33_1_bk\boost\smart_cast.hpp(200):
warning C4541: 'dynamic_cast' used on polymorphic type 'polymorphic_base'
with /GR-; unpredictable behavior may result
..\..\..\boost\smart_cast.hpp(230) : see reference to function
template instantiation 'T
boost::smart_cast_impl::pointer<T>::polymorphic::cast(const U *)' being
compiled
with
[
T=const polymorphic_derived2 *,
U=type
]
..\..\..\boost\smart_cast.hpp(286) : see reference to function
template instantiation 'T boost::smart_cast_impl::pointer<T>::cast(const U
*)' being compiled
with
[
T=const polymorphic_derived2 *,
U=type
]
..\..\..\boost\serialization\void_cast.hpp(136) : see reference to
function template instantiation 'T boost::smart_cast
test_no_rtti is somewhat mis-named. It really tests whether two different extended type info systems can inter-operate as intended. In order to write this test, I need a second one so I made one based on the "exported" identfier. I used that to test / demo that different types with different extended type info systems could inter-operate and it demonstrates that. To run the test, it DOES require that it e compiled with runtime typing. I added this facility as sort of an after thought - of course everything has unseen consequences. So what is really needed is a real effort to verify and perhaps tweak the library to support a different default extended type info system. This would entail. a) Defining an alternative system - such as one based on assigned external names - like "export" does. Or a whole new idea - perhaps based on the recent boost GUID. b) Adding a short explanation to the extended type info section of the documentation c) making a specific test for the new extended type info system. d) Running most or all of the serialization tests with this new extended type info type. If one has a lot of time on his hands, he could also add a couple of new functions to extended type info - like construction of a new instance given the "external type identifier" in order to make a poor man's COM or CORBA (C++ only) equivalent. But of course that's much more ambituous Sorry I can't offer a complete solution. Robert Ramey Ng Pan wrote:
Hi
Background: 1_33_1 Example : boost_1_33_1\libs\serialization\vc6ide\test_no_rtti
I can run the example successfully on Debug mode with no warning and no error.
However, it has several warnings, abnormal operation and memory leak when running on release mode.
The following is the warnings:
d:\barr\serialization\boost\boost_1_33_1_bk\boost\smart_cast.hpp(200): warning C4541: 'dynamic_cast' used on polymorphic type 'polymorphic_base' with /GR-; unpredictable behavior may result d:\barr\serialization\boost\boost_1_33_1_bk\boost\smart_cast.hpp(200): warning C4541: 'dynamic_cast' used on polymorphic type 'polymorphic_base' with /GR-; unpredictable behavior may result ..\..\..\boost\smart_cast.hpp(230) : see reference to function template instantiation 'T boost::smart_cast_impl::pointer<T>::polymorphic::cast(const U *)' being compiled with [ T=const polymorphic_derived2 *, U=type ] ..\..\..\boost\smart_cast.hpp(286) : see reference to function template instantiation 'T boost::smart_cast_impl::pointer<T>::cast(const U *)' being compiled with [ T=const polymorphic_derived2 *, U=type ] ..\..\..\boost\serialization\void_cast.hpp(136) : see reference to function template instantiation 'T boost::smart_cast
(U)' being compiled with [ T=const polymorphic_derived2 *, U=const type * ] ..\..\..\boost\serialization\void_cast.hpp(133) : while compiling class-template member function 'const void *boost::serialization::void_cast_detail::void_caster_primitive ::downcast(const void *) const' with [ Derived=const polymorphic_derived2, Base=const type ] ..\..\..\boost\serialization\void_cast.hpp(191) : see reference to class template instantiation 'boost::serialization::void_cast_detail::void_caster_primitive ' being compiled with [ Derived=const polymorphic_derived2, Base=const type ] ..\..\..\boost\serialization\base_object.hpp(107) : see reference to function template instantiation 'const boost::serialization::void_cast_detail::void_caster &boost::serialization::void_cast_register(const Derived *,const type *)' being compiled with [ Derived=polymorphic_derived2 ] ..\..\..\boost\serialization\base_object.hpp(103) : while compiling class d:\barr\serialization\boost\boost_1_33_1_bk\boost\serialization\extended_type_info_typeid.hpp(92): warning C4541: 'typeid' used on polymorphic type 'polymorphic_derived2' with /GR-; unpredictable behavior may result Then the following is the console output after invoking the release exe file:
Running 1 test case... unknown location(0): fatal error in "test_main_caller( argc, argv )": std::bad_typeid: Bad read pointer - no RTTI data!
*** errors detected in test suite "Test Program"; see standard output for details Detected memory leaks! Dumping objects -> {263} normal block at 0x00983EA8, 4 bytes long. Data: <D E > 44 D1 45 00 Object dump complete.
What should I do to make the release mode run correctly?
Best regards Barr Ng
_________________________________________________________________ Learn English via Shopping Game, FREE! http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E
participants (3)
-
Ben Kirk
-
Ng Pan
-
Robert Ramey