Boost logo

Boost Users :

From: kauai (kauai_diver_at_[hidden])
Date: 2005-05-04 19:17:15

--- Eyal Susser <eyal.susser_at_[hidden]> wrote:
> Hi,
> I'm using the serialization library, but have encountered
> problems.
> I have an archiver that I use with a stringstream to
> serialize
> objects. I write some ints to the archive using "ar <<
> my_int", and
> finally I archive a derived class wi ar << derived. So
> far, so good.
> In a different process, I create an input archiver, read
> the integers,
> and then pass the archiver to a different method, where I
> create an
> instance of the class I serialized and use "ar >>
> instance". This
> throws an exception.
> The code for the object created is one *.so, and teh code
> that does
> the creating does it with a templated class factory in a
> different
> *.so. Is that why I'm gettin the exceptions? Is there a
> solution?
> The exception is boost::archive::archive_exception
> what(): stream error.
> Thanks.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Are you registering all your classes you are serializing?
Your input archiver may not know about all class types in
your archive.

Use the macro BOOST_CLASS_EXPORT(ClassName) to export a
GUID for every class. This should be in a .cpp file outside
of any functions. include <boost/serialization/export.hpp>
to use it. This include should be placed after any
archiver includes.

Also within your class (if it is a container for other
classes) you will need to do this in your serialize
// if they are pointers

Have fun,

Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at