Peter Gerwinski wrote:
Is there a way to create an object so that it will be loaded only if allocated with "New"? In other words, is there a way to keep the code for the object on disk until it's needed, and removed form memory when not?
Write a constructor that fetches all needed data from the file when the object is `New'ed; if you want to keep the stuff in the file current, write a destructor that writes everything back to disk when the object is `Dispose'd. (* BTW, this has nothing to do with the internals how objects work at run-time. ;*)
I think he meant dynamically loading and freeing the code of the object's method, not it's data. AFAIK, one needs to use dynamic linking in order to achieve this, but I don't know much about it.
You are obviously writing a memory manager to keep the amount of RAM your program uses small and to use the disk instead. On UNIX-like platforms you don't need to do this because the operating system does it for you.
BTW: Do DJGPP and/or EMX do this, too?
Frank