Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Side By Side COM (RegFree COM) Problem - DLL being loaded twice!

3 views
Skip to first unread message

JamieR...@lycos.co.uk

unread,
Dec 17, 2007, 5:23:55 AM12/17/07
to
Hi All,

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.

Dmitry Shandyba

unread,
Dec 17, 2007, 8:40:16 AM12/17/07
to
On 17 дек, 12:23, JamieRThom...@lycos.co.uk wrote:
> Hi All,
>
> 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/SideBySideCOMPro...

>
> 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.

JamieR...@lycos.co.uk

unread,
Dec 17, 2007, 9:06:40 AM12/17/07
to
Hi Dmitry,

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.

Dmitry Shandyba

unread,
Dec 17, 2007, 11:21:49 AM12/17/07
to

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.

Dmitry Shandyba

unread,
Dec 17, 2007, 11:34:17 AM12/17/07
to
On 17 дек, 18:21, Dmitry Shandyba <shand...@gmail.com> wrote:

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.

JamieR...@lycos.co.uk

unread,
Dec 18, 2007, 4:15:35 AM12/18/07
to

It certainly does look like an OS loader bug!


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.

0 new messages