I have a DLL which is called from an Office productivity app. However, the initialisation data (provided by the caller) is unique to that instance. This initial data is subsequently used for correct functioning of the DLL .... At present it all works fine when I have just a single instance of the app & DLL active, but I want to progress to multiple documents ...
My question is, how do I handle multiple instances ? I can have multiple instances of the app, and/or multiple document instances. Can I tell the DLL to create a new instance each time (its not that big, so memory is not an issue), or should I create a new data structure for each instance with the unique data stored therein, or is there some other way ?
I would imagine this is a fairly common thing with MDI applications these days, but would like a 'heads up' before I start so I can go directly for the best solution.
Does anyone have any code snippets on this (preferably Delphi, but could convert VB or C code is necessary) ? All help, references etc appreciated.
Thanks
Geoff
I really do not understand your request?
As I have used librarys, the Program that loads a DLL, has that DLL as a "Part" of it's program's memory space. . . and if you start another instance of that same program, and load that same DLL, the two loaded DLL's will NOT have any connection to each other , variables are not shared and the two programs do not share any memory, and their DLL's do NOT share any memory (in Delphi, although in C++ you can specify some shared variable memory, and in Delphi you can have a Memory Mapped File to share data), , ,.
And if you have a MDI, the DLL is NOT loaded more than once, no matter how many times you call LoadLibrary( ), so in a MDI you will need to have methods to have separate DATA for each Document. . . .
so you will need to have a separate DLL function for the "initialisation data" for each Document, and then keep an Array of Document Data, or other Data storage for each document. . .
maybe more information about your MDI problems would help you get a solution?