I have developed a COM library in Delphi. When I try to "add reference" in a Visual Studio project, VS crashes. I tried to build Interop assembly by tlbimp.exe and it failed with:
TlbImp : error TI1000 : The type library importer encountered an unexpected exception: System.AccessViolationException - Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Interestingly when I "add reference" to a Web Application (or a Web Site) project, it successfully generates Interop dll and adds the reference.
It is important to me to know how tlbimp.exe is employed by Web Application project because I want to customize Interop generation.
There is most likely an error in your Delphi code. You can debug the COM library in Delphi like so:
Choose run-> parameters...

(Never mind the fact that this says project28.exe; it works the same for Projectx.dll)
I commonly develop plugins for Excel using COM.
In that case my host application is Excel.exe.
When you've entered this info you'll be able to run the library.
When you do Delphi will start the host application and wait until it somehow invokes your library.
If you've set any breakpoints Delphi will pause the action and allow you to debug.
Because you know which functions you call in your C# code, it shouldn't be difficult to see where to set the first breakpoint.
Delphi will also break on any exceptions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With