Re: [Boost-users] [Serialization]Can not export polymorphic types
Yes, I understand that. I am sorry I should have been more clear; the base class is abstract. I am able to get the "unregistered class" exception in test_no_rtti.cpp, in load_derived, by removing the serializations using derived class pointers (which register the classes). When execution tries to serialize using the base class pointer, the "unregistered class" exception is thrown. I expect this to not happen because all the classes are registered using BOOST_CLASS_EXPORT. Could BOOST_CLASS_EXPORT not be working? Do you see this when commenting out the derived class serializations in load_derived? Thanks, Daniel Roberts Only polymophic types can be serialized through a base class pointer. Robert Ramey
What happens if you try the following:
TestBase * pT1 = new TestType1;
TestBase* pT2 = new TestType2;
testOutXML << boost::serialization::make_nvp("pT1", pT1);
testOutXML << boost::serialization::make_nvp("pT2", pT2);
testTypeOFS.close();
delete pT1;
delete pT2;
...
testInXML >> boost::serialization::make_nvp("pT1", pTB);
testInXML >> boost::serialization::make_nvp("pT2", pTB);
Robert Ramey
"Daniel Roberts"
participants (2)
-
Daniel Roberts
-
Robert Ramey