4
votes

I have an application that I have just migrated to Windows 2008 R2 64bit. In essence it is a C# .NET 4.0 WCF application that makes a dynamic call to a 32bit COM application written in VC6 C++.

When I was running this on my desktop which is Windows 7 32bit the COM calls were considerably faster.

The server ought to be an order of magnitude more powerful (although in a HOSTED environment)

Are there any quick/easy things I can check to try and get to the bottom of this? I am due today to get alook at the resources allocated to the virtual machine but in the mean time..

Is this a 64bit calling 32bit COM thing?

Thank you!

1
The solution would be to compile the COM application against the x64 platform. There should be no reason a newer version of Visual Studio ( i.e. Visual C 6 was Visual Studio 6 at the time they were just marketed as seperate programs ).Security Hound
Too many missing details. Is this an out-of-process COM server? Does it run on the same machine? What is "hosted", does it actually run in a virtual machine? COM+? Does the managed code run in AnyCPU? Is this an apartment threaded object?Hans Passant

1 Answers

5
votes

Running 32-bit code from 64-bit processes is very time-consuming, because it involves the Windows on Windows subsystem (WoW). 64-bit code and 32-bit code cannot be run within the same process, which means that all calls from your code to the 32-bit dll must pass process and architecture boundaries, which involves some heavy data marshalling and function call marshalling.

http://blog.mattmags.com/2007/06/30/accessing-32-bit-dlls-from-64-bit-code/

Do some profiling to measure the performance of your app in different situations.

  • Compile to Any-CPU, run on x64
  • Compile to x64, run on x64
  • Compile to x86, run on x64

Then do what gives you the most performance.

However...

If you have access to the COM library source code, the very best thing would be to recompile it on the x64 platform.