Boost logo

Boost :

Subject: Re: [boost] serialization in multiple dlls
From: pipalapop (pipalapop_at_[hidden])
Date: 2010-12-10 04:23:56


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_at_[hidden]> a écrit : > De: Robert Ramey <ramey_at_[hidden]> > Objet: Re: [boost] serialization in multiple dlls > À: boost_at_[hidden] > Date: Mercredi 8 décembre 2010, 19h04 > pipalapop wrote: > > Hi, > > I have a problem with the deserialization of objects > defined in > > multiple dlls. > > I define the following classes in a first dll: > polymorphic_base (pure > > virtual) and polymorphic_derived1 (derived from > polymorphic_base). > > In a second dll, I define the class > polymorphic_derived2 (derived > > from polymorphic_derived1). > > In an executable, I serialize an object of type > polymorphic_derived2 > > 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 > polymorphic_derived1; > > oa << BOOST_SERIALIZATION_NVP(pb_ptr_1); > > > > polymorphic_base * pb_ptr_2 = new > polymorphic_derived2; > > oa << BOOST_SERIALIZATION_NVP(pb_ptr_2); > > > > polymorphic_base * pb_ptr_3 = new > polymorphic_derived1; > > 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 > polymorphic_derived1) has broken > > the part of table cobject_id_vector concerning > 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 >


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk