G
Guest
I have a mix-mode Managed C++ dll which wraps some C++ static library and
exposes functions to C# IRTDServer.
So the scenario is like this:
C++ Static library (with static member variables in classes)
|
|
v
Managed C++ dll
|
|
v
C# IRTDServer (to be used in Excel Add-Ins)
|
|
v
Microsoft Excel
IRTDServer calls Managed C++'s minitialize() everytime IRTDServer's
ServerStart() function is called by Excel.
IRTDServer then calls Managed C++'s mterminate() everytime IRTServer's
ServerTerminate() function is called by Excel, e.g. when a worksheet is
closed or when Excel is closed.
However, I found out that Managed C++'s minitialize() returns false the
second time I re-open an Excel worksheet.
My questions are:
1. Is it allowed to call minitialize() and mterminate() multiple times?
1.1 If so, why does minitialize() return false the second time
it is called?
2. I also looked into the code in vcclrit.h and found out minitizlie()
returns false because global variables __initialized and __terminate are not
reset to false in mterminate().
I then reset the value myself but it causes some even more strange errors.
exposes functions to C# IRTDServer.
So the scenario is like this:
C++ Static library (with static member variables in classes)
|
|
v
Managed C++ dll
|
|
v
C# IRTDServer (to be used in Excel Add-Ins)
|
|
v
Microsoft Excel
IRTDServer calls Managed C++'s minitialize() everytime IRTDServer's
ServerStart() function is called by Excel.
IRTDServer then calls Managed C++'s mterminate() everytime IRTServer's
ServerTerminate() function is called by Excel, e.g. when a worksheet is
closed or when Excel is closed.
However, I found out that Managed C++'s minitialize() returns false the
second time I re-open an Excel worksheet.
My questions are:
1. Is it allowed to call minitialize() and mterminate() multiple times?
1.1 If so, why does minitialize() return false the second time
it is called?
2. I also looked into the code in vcclrit.h and found out minitizlie()
returns false because global variables __initialized and __terminate are not
reset to false in mterminate().
I then reset the value myself but it causes some even more strange errors.