Boost logo

Boost Users :

From: sadrok (sadrok.za_at_[hidden])
Date: 2007-01-06 16:33:08


Hi,

This would be my first post here. Needless to say I'm relatively a
newbie when it comes to using Boost.

I've recently decided to look into using Boost to ease some tasks in
my future programming projects. I've stumbled upon Boost.Serialization
and was amazed at the ease and power it provides.
I've decided to use this to replace a hand-wrapped serialization
library I created for a project I'm involved with since I foresee in
the future more difficult serialization tasks that my library wouldn't
be able to handle.

So far so good, but during replacing my code with Boost.Serialization
and going through various static asserts I've come to a obstacle I
cannot figure out.

My application saves message classes derived from a Message base class
(it has a virtual deconstructor) and sends this serialized data over a
UNIX socket for IPC between interconnected processes.
The sending side seems to work fine as can be seen from the debugging
output below:

In base/module.cpp line 111 function SendMessage :
[
22 serialization::archive 3 4 core 10 LogMessage -1209954316 1 18
Sadrok::LogMessage 1 0
0 0 1168098092 55 Loaded module log from file modules/liblog.so pid 14250
]

However on the receiving side I have this:
                ia & BOOST_SERIALIZATION_NVP(msginfo.msg);
which ends up throwing an bad_cast exception
                Unhandled exception: St8bad_cast

msginfo.msg is Message*
I even tried loading into a LogMessage * with the same error.

I have (in the logmessage header) BOOST_CLASS_EXPORT for the
LogMessage (otherwise Boost would've thrown unregistered_class while
saving).

I can provide more information although I wouldn't know what else to
post. Generally I'd like to know if anyone has any idea why I'm
getting the bad_cast exception, where it gets thrown, or at least how
to figure out where the problem exists so I can fix it.

Thank you

Sadrok
sadrok.za_at_[hidden]

Yahoo! IM: sadrok_za
Jabber ID: sadrok_at_[hidden]


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