1

We have an Delphi application that has a built in com object. When compiled in Delphi XE3 (Windows 8) we can't reference it from Visual Studio C#. However, an older version that was compiled in Delphi 2010 (Windows 7) works as expected.

The com object registers without errors and i can access it by using VBA script in Excel. Has anyone come accross something like this?

1 Answer 1

1

The most likely explanation is a bitness mismatch. I'm assuming that the COM server is 32 bit since you have been compiling it in Delphi 2010.

Suppose that your COM server is an in-proc server. Then I guess that your failing host is a 64 bit application. If so then you need to make the bitness match. Most probably by switching your host to be 32 bit by targeting x86.

If the COM server is out-of-proc then the issue is with registration rather than executable bitness matching. It will be registered in the 32 bit registry view, but your 64 bit host is looking in the 64 bit view. This would explain why your 32 bit Excel VBA code can find it. You need to register the server in both 32 and 64 bit registry views. Or switch the host to 32 bit.

Sign up to request clarification or add additional context in comments.

9 Comments

That makes perfect sense! The Com Server is out-of-proc and is self-registered by calling TComServer.UpdateRegistry(True). How do you get it to register in both 32 and 64-bit registry view? If you register it manually using regserver, which registry view does it actually register in?
I'm not an expert in this at all. It looks like you need to build and register 32 and 64 bit proxy/stub DLLs. If you are not using a proxy then I guess you can just register your exe in the 64 bit view of the registry, as well as 32 bit view. You'll have to write special code to do that.
But the first thing to do is build your VS project as 32 bit to prove that this is the issue.
The out-of-proc application (a stand-alone exe file) is built as 32-bit but compiled on a 64-bit OS. I'm also trying to access it on a 64-bit machine using C#
The OS is irrelevant. All that matters is the bitness of the server and the bitness of the client. Are you using proxy DLL?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.