
Thanks for your answer. Do you think that there is a problem in the API to support this form of implementation? If not, have you an idea to allow it? Regards, Yohan --- En date de : Mer 8.12.10, Robert Ramey <ramey@rrsd.com> a écrit :
Hi, I have a problem with the deserialization of objects defined in multiple dlls. I define the following classes in a first dll:
virtual) and polymorphic_derived1 (derived from
In a second dll, I define the class
from polymorphic_derived1). In an executable, I serialize an object of type
followed and two objects of type polymorphic_derived1 in the order defined in this function:
void save_exported (const char *testfile) { std::ofstream os(testfile); xml_oarchive oa(os);
polymorphic_base * pb_ptr_1 = new
oa << BOOST_SERIALIZATION_NVP(pb_ptr_1);
polymorphic_base * pb_ptr_2 = new
oa << BOOST_SERIALIZATION_NVP(pb_ptr_2);
polymorphic_base * pb_ptr_3 = new
oa << BOOST_SERIALIZATION_NVP(pb_ptr_3);
}
The serialization works, but when, I try to deserialyze with this function:
void load_exported(const char *testfile) { std::ifstream is(testfile); xml_iarchive ia(is);
polymorphic_base * pb_ptr_1 = NULL; ia >> BOOST_SERIALIZATION_NVP(pb_ptr_1);
polymorphic_base * pb_ptr_2 = NULL; ia >> BOOST_SERIALIZATION_NVP(pb_ptr_2);
polymorphic_base * pb_ptr_3 = NULL; ia >> BOOST_SERIALIZATION_NVP(pb_ptr_3); // <= exception
}
an exception is thrown on the deserialization of the second object of type polymorphic_derived1 but it works for the first one.
in the file basic_archive.cpp, line 466 : "pending_bis = & bpis_ptr->get_basic_serializer();" bpis_ptr is null.
It seems that the deserialization of the object of type polymorphic_derived2 (derived from
the part of table cobject_id_vector concerning
De: Robert Ramey <ramey@rrsd.com> Objet: Re: [boost] serialization in multiple dlls À: boost@lists.boost.org Date: Mercredi 8 décembre 2010, 19h04 pipalapop wrote: polymorphic_base (pure polymorphic_base). polymorphic_derived2 (derived polymorphic_derived2 polymorphic_derived1; polymorphic_derived2; polymorphic_derived1; polymorphic_derived1) has broken polymorphic_derived1.
If polymorphic_derived2 is defined in the first dll,
there is no
problem.
Is it possible to make it works with 2 dll?
probably, but would required some investigation.
Robert Ramey
Regards, Yohan
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost