Hello,
My program crashes at launch (not even a exit(0) as
the first line of main(int argc, char *argv[]) will stop it from crashing), due
to the BSL.
What I am trying to do is: I have a class, whose
serialization is split (eg, save and load functions are provided, and they are
different). Now this class had a parent class, so I used to call boost::serialization::base_object<MObject>()
on the base class MObject.
However I want to change the parent of my class to a
different class. I also want to update my old archives, so I decided to leave
the load function of my class untouched, while I would change the save function,
to update the call to base_object to the new parent class (not MObject anymore).
I thought it would work, since it would load the old archive using the same
method, but save it using the new, so I would have ran only one time the
program and the archive would be updated (then, of course, before running it
again I would have to recompile it one more time with the correct changes to
the load function).
But it does not work as expected, since it seems the
BSL does not like the fact that save and load functions calls to boost::serialization::base_object
do not specify the same base class. It does not complain at compile time but
crashes at run time before even entering main and certainly before loading any
archive. The crash is due to a NULL pointer, I have tried to debug with gdb but
the crash apparently occurs on the _libkernel32_a_iname
() so I do not not know where it is (too low level for me).
Robert, do you have an idea what is going on? I
suspect a bug – however if it is “normal” behaviour (I think
it should then throw an exception rather than crash), do you have an idea how
could I update my archives? I need to change the parent of this class, but need
to be able to read my old archives – and changing them “by hand”
by looking into the XML archive code is tool hard.
Thank you, regards
Jean-Noël Rivasseau