Hello,
I am developing classes in C# that are called from PHP via COM. The C# code
does a lot of work to establish internal data structures, and I would like
these data structures to persist so that I do not have to recreate them each
time the COM code is called.
For example, imagine a function MyObject.BuildI nternalDataStru ctures() which
takes a long time. Another function, MyObject.UseInt ernalDataStruct ures(),
is called repeatedly. The first time UseInternalData Structures is called,
it detects that the structures haven't been built, so it calls
BuildInternalDa taStructures. Subsequent calls to UseInternalData Structures
do not need to incur the penaly of building the internal data structures.
The problem is that on my web server, PHP instantiates a new instance of my
object each time a PHP page is hit -- and destroys the object (and unloads
my DLL) when the page completes executing. So the next time the user hits a
PHP page that calls out to MyObject.UseInt ernalDataStruct ures(), it has to
rebuild everything again from scratch.
Is there a way to build a COM server as an EXE, so that it can run in the
background, maintaining its state, while allowing COM consumers (such as
PHP) to call into it?
Thanks
Greg
I am developing classes in C# that are called from PHP via COM. The C# code
does a lot of work to establish internal data structures, and I would like
these data structures to persist so that I do not have to recreate them each
time the COM code is called.
For example, imagine a function MyObject.BuildI nternalDataStru ctures() which
takes a long time. Another function, MyObject.UseInt ernalDataStruct ures(),
is called repeatedly. The first time UseInternalData Structures is called,
it detects that the structures haven't been built, so it calls
BuildInternalDa taStructures. Subsequent calls to UseInternalData Structures
do not need to incur the penaly of building the internal data structures.
The problem is that on my web server, PHP instantiates a new instance of my
object each time a PHP page is hit -- and destroys the object (and unloads
my DLL) when the page completes executing. So the next time the user hits a
PHP page that calls out to MyObject.UseInt ernalDataStruct ures(), it has to
rebuild everything again from scratch.
Is there a way to build a COM server as an EXE, so that it can run in the
background, maintaining its state, while allowing COM consumers (such as
PHP) to call into it?
Thanks
Greg
Comment