COM interop problem on 64bit OS

Y

Yoavo

Hi,

I have a C# application built as AnyCPU which calls a 32 bit c++ application
(via COM interops).
When the c# application run on a 32 bit OS there is no problem.
But when I run it on 64 bit OS, the application failed to load the 32 bit
c++ application (I guess it is because it can't access the Wow6432Node in
Registry).

Is there a way to overcome this problem ?

thanks,
Yoav.
 
J

Jeff Gaines

Hi,

I have a C# application built as AnyCPU which calls a 32 bit c++
application (via COM interops).
When the c# application run on a 32 bit OS there is no problem.
But when I run it on 64 bit OS, the application failed to load the 32 bit
c++ application (I guess it is because it can't access the Wow6432Node in
Registry).

Is there a way to overcome this problem ?

Try compiling for X86, that should work.
 
J

Jeff Gaines

Hi,

I have a C# application built as AnyCPU which calls a 32 bit c++
application (via COM interops).
When the c# application run on a 32 bit OS there is no problem.
But when I run it on 64 bit OS, the application failed to load the 32 bit
c++ application (I guess it is because it can't access the Wow6432Node in
Registry).

Is there a way to overcome this problem ?

Try compiling for X86, that should work.
 
Y

Yoavo

I know that, but my application should run as 64 bit application also.
This is why I build it with AnyCPU configuration.
 
Y

Yoavo

I know that, but my application should run as 64 bit application also.
This is why I build it with AnyCPU configuration.
 
J

Jeff Gaines

I know that, but my application should run as 64 bit application also.
This is why I build it with AnyCPU configuration.

A 32 bit app will run fine on a 64 bit OS. COM is from the 32 bit days, I
think you are attempting the impossible.
 
J

Jeff Gaines

I know that, but my application should run as 64 bit application also.
This is why I build it with AnyCPU configuration.

A 32 bit app will run fine on a 64 bit OS. COM is from the 32 bit days, I
think you are attempting the impossible.
 
F

Family Tree Mike

Yoavo said:
I know that, but my application should run as 64 bit application also.
This is why I build it with AnyCPU configuration.


Jeff Gaines said:
Try compiling for X86, that should work.

Your code must execute in 32 bit mode once you introduce a dependence on a
32 bit library. If running in 64 bit mode is a requirement, then you need to
find an alternative to your com utilities.

Mike
 
F

Family Tree Mike

Yoavo said:
I know that, but my application should run as 64 bit application also.
This is why I build it with AnyCPU configuration.


Jeff Gaines said:
Try compiling for X86, that should work.

Your code must execute in 32 bit mode once you introduce a dependence on a
32 bit library. If running in 64 bit mode is a requirement, then you need to
find an alternative to your com utilities.

Mike
 
P

Pavel Minaev

I know that, but my application should run as 64 bit application also.

Why? Do you actually have any specific requirements (i.e. memory)?

Keep in mind that it will otherwise happily run on 64-bit Windows, and
with .NET x64 installed (since that includes x86 version).

In general, a 64-bit process cannot execute any 32-bit code. The only
workaround is to split into two processes, and use IPC (such as named
pipes directly, or something higher-level such as .NET remoting) to
communicate. So your .NET app is still 64-bit, then you have a
separate small 32-bit process (could also be .NET) that loads the 32-
bit COM object, and exposes all its functionality via IPC.
 
P

Pavel Minaev

I know that, but my application should run as 64 bit application also.

Why? Do you actually have any specific requirements (i.e. memory)?

Keep in mind that it will otherwise happily run on 64-bit Windows, and
with .NET x64 installed (since that includes x86 version).

In general, a 64-bit process cannot execute any 32-bit code. The only
workaround is to split into two processes, and use IPC (such as named
pipes directly, or something higher-level such as .NET remoting) to
communicate. So your .NET app is still 64-bit, then you have a
separate small 32-bit process (could also be .NET) that loads the 32-
bit COM object, and exposes all its functionality via IPC.
 
J

Joel Lucsy

Jeff said:
A 32 bit app will run fine on a 64 bit OS. COM is from the 32 bit days,
I think you are attempting the impossible.

COM works just fine in 64 bit. In fact, many things in Windows could not
be accomplished without it. However, the OP needs to have a 64 bit
version of the COM component in question in order for his program to
work correctly, of which there might not be one.
 
J

Joel Lucsy

Jeff said:
A 32 bit app will run fine on a 64 bit OS. COM is from the 32 bit days,
I think you are attempting the impossible.

COM works just fine in 64 bit. In fact, many things in Windows could not
be accomplished without it. However, the OP needs to have a 64 bit
version of the COM component in question in order for his program to
work correctly, of which there might not be one.
 

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