Software and methods for extending preexisting objects to support
persistence. One use of the present invention is to extend component
object model (COM) objects to support persistence in a simple, predefined
system. COM objects may be saved to persistence storage and loaded from
persistence storage using user-provided save and load methods. When
objects are constructed, the objects are added to a Persistent Object
Registry. Objects preferably utilize smart pointers, rather than simple
pointers, in order to enable restoration of the pointer values after a
save and load cycle. The smart pointers include an object ID along with
the address. The object ID, together with the information stored in the
Persistent Object Registry, may be used to restore a pointer value after
loading. Objects may be saved by streaming the objects out and loaded by
streaming the objects back into memory from a file.