On 3/11/2022 20:40, Markus Lavin wrote:
If a serialized object in the dynamic part contains a pointer to a non-seralized object in the static part then how do I deal with that. Clearly the address cannot be serialized since it may change between builds and even between runs (ASLR). The program does contain a 'registry' though where all relevant static objects are registered with a unique identifier.
So question is would it somehow be possible to have Boost serialization use this registry to serialize the unique identifier instead of trying to serialize the entire object when one of those pointers are serialized?
Each class can choose exactly what data it serializes and deserializes, and what it does with it. For this case it sounds like you probably want https://www.boost.org/doc/libs/1_80_0/libs/serialization/doc/tutorial.html#s... such that you can save an internal id and then reload that id and look up the corresponding pointer, rather than serializing the other object directly. You can still cascade into the other object as a reference to save/load its dynamic state after that. You will likely also want to read about https://www.boost.org/doc/libs/1_80_0/libs/serialization/doc/special.html#ob...