- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have this problem, I've got a DLL which is loaded and unloaded at runtime many times. I need to mantain some data values between one loading time and the following loading time. how can I do that?
I have this problem, I've got a DLL which is loaded and unloaded at runtime many times. I need to mantain some data values between one loading time and the following loading time. how can I do that?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Roberto Sartori
Hi,
I have this problem, I've got a DLL which is loaded and unloaded at runtime many times. I need to mantain some data values between one loading time and the following loading time. how can I do that?
I have this problem, I've got a DLL which is loaded and unloaded at runtime many times. I need to mantain some data values between one loading time and the following loading time. how can I do that?
Well, don't load it and unload so many times then :-D.
Generally, you can't persist the variables in memory between subsequent loads, (obviously, because you cannot know when the caller is going to reload your dll).
What you can do is to persist the data to a (semi-)permanent storage (disk file, registry, or a shared memory file if you desperately need speed). The best place for that would be cases DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH of your DllMain function. Note that, generally, this processing in DllMain should be fast and simple (see http://blogs.msdn.com/larryosterman/archive/2004/04/23/118979.aspx).

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page