I have a set of libraries written in Delphi.NET (.NET 1.1) which I want to use in my Win32 (Delphi) application. For performance related issues, I've decided to follow the COM route.
Sometimes, after rebuilding the DLL, when I try to instantiate the objects exposed through COM, the Win32 application hangs at the CreateComObject
call. How can I solve this problem?
To expose the Delphi.NET libraries through COM, I add the following attributes above each class deceleration:
[Comvisible(true)]
[Guid('some guid')]
[ClassInterface(ClassInterfaceType.AutoDual)]
After compiling the DLL, I generate a TLB.pas
file, this file contains definitions for all public and COM visible classes and interfaces in the DLL. This file allows me to more easily use the COM objects in my Delphi Win32 application. Finally, I register the .dll
and the .tlb
flie using regasm
.
I've tried unregistering and running the Win32 app, which references the DLL; I expected to receive a run-time error, but the application once again hung at the CreateComObject()
call.
I've also tried unregistering and registering the DLL without any luck.
p.s. I am using BDS 2006