One way would be to make EVERYTHING in your software serializable:
(and I like) http://msdn.microsoft.com/en-us/library/ms733127.aspx
Then you can dump and load the objects with relative ease...I don't think there is a mechanism like hibernate though.
Oh sorry, I mixed up the forums. You are right...there is no native C++ serialize (there is in C++/CLI though), you'd have to write such a mechanism yourself. If you can change the legacy app, than you could implement your own serializeable interface (a "ToXML" function would work nicely) BUT it would probably end up being a ton of work.
If you are using C# wrappers around your C++ code, you could still implement the serialize attribute on the wrapper classes, but this would probably be hard to get a non-shallow implementation...
Just force the app to swap out, and its state will be nicely preserved in the system page file. Windows also has prefetch feature to accelerate load time. It has been well tested and optimized.
Before rolling your own and reinventing the wheel, it's worth to learn the optioipns at hand. Investing in a fast disk for the pagefile will help too.
Can you please explain more on how this swap works so that process state will be saved in disk and reuse when required?
It's very simple. The Page file is a special place on a disk where inactive processes are stored in highly optimized way. When such process resumes running, the system automagically reads it back to memory and it just continues from where it was. It is sort of how programs run on iPad :)
All this functionality is already built into Windows. While your process keeps running, the system ensures that it is either in the memory or in the page file (there are few exceptons though, which you can ignore).
Hope this helps,
- Edited by Pavel A Wednesday, March 28, 2012 8:44 PM
- Proposed as answer by Jesse JiangMicrosoft community contributor, Moderator Thursday, March 29, 2012 3:03 AM