From: Dave Harris (brangdon_at_[hidden])
Date: 2007-03-19 15:21:33
ramey_at_[hidden] (Robert Ramey) wrote (abridged):
> > I did something stupid with my serialization code. I blithely changed
> > the names of several polymorphic classes everywhere they appeared in
> > the code, since they had moved out of a class into that class's
> > namespace (e.g. SomeNS::View::Primitive became SomeNS::Primitive).
> > Several months later, I discovered that I could no longer read old
> > binary archives, because I was using Boost.Serialization's
> > BOOST_CLASS_EXPORT() macro, and this macro was now registering the
> > Primtive type with the name-string "Primitive", instead of
> > "View::Primitive", which is how it was saved in the oldest archives.
> > would it be technically possible to add a
> > BOOST_CLASS_EXPORT_ALIAS() macro, or some such? If it is possible,
> > I'm willing to supply the implementation.
> I might be possible by hacking your own copy of extended_type_info.hpp.
> I don't think we'd want to include such thing in the library.
I don't currently use boost serialisation so feel free to ignore me. I do
use another library that uses class names for IDs, and I think some kind
of aliasing or remapping facility is inevitably needed. In other words, if
you support BOOST_CLASS_EXPORT() then you should also support
(I also think that using class names is a fairly good and natural way to
> So I would suggest:
> a) make the hack
> b) make small program which loads your old archives and creates new
> This should be very easy.
> c) Forget this ever happened.
If by this you mean they should convert all the user data in one huge
conversion binge, then that's not always practical. Sometimes the
conversion has to be done inline, with the old archive format supported
forever by all future version of the program.
-- Dave Harris, Nottingham, UK.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk