Hi Folks,
I have a process (Excel.exe) that seems to map a certain custom DLL into
memory twice. What I need is a single copy, with a single set of data. If
anyone can help with any of the following questions I would be most
grateful.
1. What are the NT rules for loading multiple copies of the same DLL into
the address space of a single process?
I have played with multiple class to LoadLibrary() and it seems to force
a single copy.
2. What series of calls could cause the DLL be loaded twice?
Is possible (probably) that I'm missing the fundamental NT process/module
management knowledge.
My specific problem is:
I have a DLL which is both a COM inprocess server and an Excel C++ Addin
(xll).
I do this because I want to add VBA behaviour and Excel worksheet functions
to
a common set of data (that's in the DLL). Excel loads the DLL twice, once
as a
COM server and once as a Excel Addin, but the result is two copies of the
DLL
in Excel's address space (and so no common data set). In this case the DLL
is loaded by actions:
1. Excel's COM because of VBA dim new statement
2. By VBA code calling Application.RegisterXLL("full path of COM
server DLL")
I tried breaking the DLL into two, 1) a COM server 2) as Excel Addin DLL
with
is merely a stub for calls to the COM server DLL
1. Excel's COM because of VBA dim new statement
2. By VBA code calling Application.RegisterXLL("Stub DLL") which
then goes no to load the COM DLL because it has a link time
dependency.
Thanks for any assistance, Neil