[serialization] test_dll_exported in VS2012
Hi! I am currently trying to run the test_dll_exportet test in Visual Studio 2012, with polymorphic_derived2.cpp in a DLL and test_dll_exportet.cpp in the executable. Compiling and Linking works fine, but when I run the test, I get an "unregistered void cast class polymorhpic_derived2<-polymorhpic_base" error at line 85 of test_dll_exportet.cpp. Running the same test using the library_test tool (library_test --toolset=msvc-11.0) yields no errors. Does anybody have an idea what the cause for this problem might be? -- View this message in context: http://boost.2283326.n4.nabble.com/serialization-test-dll-exported-in-VS2012... Sent from the Boost - Users mailing list archive at Nabble.com.
In case anyone stumbles upon a similar problem: The serialization of of objects through thier polymorphic base class in a dynamic library appearently requires that boost ist also linked dynamic, which is achieved by adding the BOOST_ALL_DYN_LINK=1 define. Maybe someone can add this point to the documentation. -- View this message in context: http://boost.2283326.n4.nabble.com/serialization-test-dll-exported-in-VS2012... Sent from the Boost - Users mailing list archive at Nabble.com.
On Fri, Jan 17, 2014 at 2:45 AM, Stefan Gradinger
The serialization of of objects through thier polymorphic base class in a dynamic library appearently requires that boost ist also linked dynamic, which is achieved by adding the BOOST_ALL_DYN_LINK=1 define.
Maybe someone can add this point to the documentation.
I don't know if it's already mentioned there, and perhaps it does deserve calling out specially. If it's not yet mentioned, though, it might be because this is only a particular case of a much more general problem. Of your main executable and the dynamic libraries it loads, if any two of them use the same library, you must dynamically link with that library. Otherwise you have two (or more) instances of the library and its data in the process's memory. "Singletons" become "doubletons." Trouble ensues -- as you discovered.
participants (2)
-
Nat Goodspeed
-
Stefan Gradinger