Boost logo

Boost Users :

Subject: [Boost-users] issues with BOOST_CLASS_EXPORT
From: Lukas Diduch (lukas.diduch_at_[hidden])
Date: 2010-04-15 17:53:28


I'm serializing two different classes (fooA, fooB) using boost::any using a
wrapper template class combined with a handmade NVP (for the type) under
boost_1_42_0.

Serializing every type multiple times works fine. However if i use
BOOST_CLASS_EXPORT (fooA) to register the type, after the SECOND call that type
(fooA) is not being serialized properly anymore. Any subsequent serialization
fails.

the (text)archive of the correct case:

22 serialization::archive 7 4 fooA 0 0 10 4 fooB 0 0 1.5 4 fooB 2.5 4 fooA 20

the (text)archive of the broken case:

22 serialization::archive 7 4 fooA 1 0
0 10 4 fooB 0 0 1.5 4 fooB 2.5 4 fooA
0

Does that make sense to anybody ? Maybe a bug ? Note also that in the 'broken'
case the archive is split into three lines instead of one. Sorry for not
posting the example code but it's quite lengthy. If neccesary i'll do so.

To put you in a bigger context: i'd like to serialize types using sockets
across different architectures (different typeids who'd have guessed). I don't
know the order in which the types are sent, so i guess i should register the
types upfront using BOOST_CLASS_EXPORT to make sure save and load are in sync
on any arch at any time. Please correct me here if i'm wrong and don't need to
use the export.

Sincerely
Lukas Diduch


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net