We are using VC++ 2005 and have a large product with the following
combination of DLLs
1. ATL/COM DLLs
2. C++ DLLs with exported functions
3. A mix of both of the above.
We have a requirement to support side by side installs of different
versions of our software; so we are using side-by-side COM (or RegFree
COM as it's also called). More info is here in an MSDN article:
http://msdn.microsoft.com/msdnmag/issues/05/04/RegFreeCOM/
We have a problem where a DLL which has both ATL/COM objects and
exported C++ functions is loaded into memory twice. This only happens
when using SxS COM - if I take out the manifest entry and register the
DLL (aka via RegSvr32) then the DLL is only loaded once.
I've drawn a diagram which demonstrates this problem exactly:
http://i10.photobucket.com/albums/a148/JamieRThomson/SideBySideCOMProblem.jpg
I also have a sample project in a zip file, although I don't have a
good place to uploaded it to - so I can email it to anyone interested.
Is anyone out there using SxS/RegFree COM? Any suggestions? It seems
the SxS COM code is not checking if my DLL is already loaded...
Thanks,
James Thomson
MCSD
UK.
James, having read some docs about SxS I'm thinking about the
following:
can't it happen that Windows thinks of these 2 files (that are
actually the same) as of 2 different files by definition?
One is a versioned SxS component and another one is... just a dll
loaded with LoadLibrary, not referenced via any manifests etc?
I'm trying to reference both dlls (through the intermidiate manifest)
now but without any results yet, thus it might not be the case at all
I'm afraid.
Yes that crossed my mind, although if you load the DLL first via the C+
+ exported function and then via SxS COM it is all fine and you only
only a get the dll loaded once - which is all a little inconsistant.
I'm interested to hear about any of your findings :)
Cheers,
James.
James,
just an intermediate note: CoInitialize seems not to be called in the
thread that creates SxS object :)
Though it doesn't resolve the issue.
It is really very strange that order in which we use the dll results
in different behaviour.
Dmitry.
This time I made a mistake. Although COM is not initialized explicitly
from the code it seems that the thread is already COM-initialized by
the time it reaches my CoInitialize[Ex] calls.
In regards to original issue I do really begin thinking about your
hypothesis of problems in os executables loader...
It would be really interesting to hear what other people think of it.
Dmitry.
I've put the zip file with the VS2005 example here:
http://www.megafileupload.com/en/file/29786/SideBySideTest--2--zip.html
Hopefully this works - I don't have a better place to upload to :)
In the example the manifest files with the SxS COM info are in the
output directory - it's easier to fiddle with them from there.
Thanks,
James.