x64 COM object doesn't show up in Add Reference

T

Tamas Demjen

I'm porting a 32-bit in-process COM server into x64. This is an SDK that
our customers will use from 64-bit applications only.

We also have a .NET interop layer. But when I try to invoke the Add
Reference dialog, my component doesn't show up on the COM tab. It seems
that Visual Studio 2005 only shows the 32-bit COM objects. I haven't
tried Visual Studio 2008 yet.

I could get it to work by adding the interop DLL directly to the
project, but normally we would pick the component from the COM tab.

I realize that 64-bit and 32-bit COM objects can co-exist on the same
system, and they can be registered independently. However, our original
intention was to not ship the 32-bit DLLs in our 64-bit SDK. That might
have been a not so good assumption though.

My questions is: Is it considered a bad practice to ship the 64-bit part
only? Would you install and register the 32-bit DLLs even for the
customers who exclusively program in x64?

Thanks,
Tom
 
J

Jochen Kalmbach [MVP]

Hi Tamas!
We also have a .NET interop layer. But when I try to invoke the Add
Reference dialog, my component doesn't show up on the COM tab. It seems
that Visual Studio 2005 only shows the 32-bit COM objects. I haven't
tried Visual Studio 2008 yet.

VS* runs as x86 application, so it will only display x86 COM objects (or
out-proc servers).
I could get it to work by adding the interop DLL directly to the
project, but normally we would pick the component from the COM tab.
....


I realize that 64-bit and 32-bit COM objects can co-exist on the same
system,

Only "in-proc-servers".
My questions is: Is it considered a bad practice to ship the 64-bit part
only?
No.

Would you install and register the 32-bit DLLs even for the
customers who exclusively program in x64?

If the user might use both worlds, why not?

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
T

Tamas Demjen

Jochen said:
Only "in-proc-servers".

I came across this document that claims that 64-bit out-of-proc servers
can be used from 32-bit processes:
http://windowshpc.net/Resources/Documents/64-bit Insider Volume 1 Issue 12.pdf

That makes sense, marshaling should be machine independent, but I'm not
100% sure. I wanted to try it, but unfortunately the registration part
doesn't work to begin with. When I call myserver.exe /regserver, it only
registers the Win64 part:
HKEY_CLASSES_ROOT\TypeLib\{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\5.0\0\win64

32-bit processes can only see the COM object if I manually create a
win32 key in the registry, pointing to the same 64-bit executable. I
don't feel good about it.

The situation is that we have an NT service, which is an out-of-proc COM
server at the same time, and I can't have separate 32-bit and 64-bit
versions of it. So I was wondering if it was safe to call into this
64-bit service from a 32-bit process (after manually fixing the registry
by adding the win32 key).

Thanks for the feedback. So if I only install the 64-bit version, we
have to use the Browse tab in the Add Reference dialog, because it won't
show up on the COM tab. I guess that's fine then.

Tom
 
J

Jochen Kalmbach [MVP]

Hi Tamas!
I came across this document that claims that 64-bit out-of-proc servers
can be used from 32-bit processes:
http://windowshpc.net/Resources/Documents/64-bit Insider Volume 1 Issue 12.pdf

Yes, that is exactly what I say: It can only exist *one*
Out-Proc-Server; and it might exist *two* InProc-Servers.
32-bit processes can only see the COM object if I manually create a
win32 key in the registry, pointing to the same 64-bit executable. I
don't feel good about it.

This is a little bit mystic of the registry-redirector:
http://www.codeproject.com/system/Reflection.asp

The situation is that we have an NT service, which is an out-of-proc COM
server at the same time, and I can't have separate 32-bit and 64-bit
versions of it.

No. You only can register one.
So I was wondering if it was safe to call into this
64-bit service from a 32-bit process (after manually fixing the registry
by adding the win32 key).

Yes, you can use an Out-Proc-Server regadless of the processor-type.
Thanks for the feedback. So if I only install the 64-bit version, we
have to use the Browse tab in the Add Reference dialog, because it won't
show up on the COM tab. I guess that's fine then.

Out-Proc-Servers should be displayed as well...


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
T

Tamas Demjen

Jochen said:
Out-Proc-Servers should be displayed as well...

The 64-bit out-proc server doesn't show up in Visual Studio.
myserver.exe /regserver creates the following registry entry, which is
reflected in the 32-bit registry too (I see it in regedit and
Wow64\regedit as well):

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{...}\5.0\0\win64]
@="C:\\Program Files\\MyCompany\\myserver.exe"

If I manually add this to the registry, the out-proc server shows up in
Visual Studio:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{...}\5.0\0\win32]
@="C:\\Program Files\\MyCompany\\myserver.exe"

The type library registration may not be working well. It's ATL, but the
original project was written in VC6 a long time ago, and got migrated
into VS 2005. I have to research how to register 64-bit out-proc servers
so that 32-bit processes can access it too.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top