Gustavo
Gustavo

Reputation: 931

Delphi and COM: TLB and maintenance issues

In the company that i work, we develop all the GUI in C#, but the application kernel is mainly developed in Delphi 5 (for historical reasons), with a lot of components made in COM+. Related to this very specific sort of application a I two questions:

Upvotes: 9

Views: 6011

Answers (5)

Roddy
Roddy

Reputation: 68033

I think you should have a good look at Delphi 2009.

Delphi 2009 has changes to the COM support, including a text-based replacement for the binary TLB files.

You can read more on Chris Bensen's blog.

Upvotes: 11

skamradt
skamradt

Reputation: 15538

Using Delphi 2009 has greatly taken much of the pain out of huge TLB files, and conversion of our existing objects was painless, but our com objects don't use any third party libraries.

We will be migrating our gui applications over once the library vendors release supported versions.

Upvotes: 3

Paul-Jan
Paul-Jan

Reputation: 17278

Same experience with the TLB interface here: we simply stopped using it.

We work with several separate IDL files (hand-build) for different parts of our framework, making use of the #include construct to include them into the IDL of the actual application, then generate the single tlb using MIDL and tlibimp it. If the application has no IDL of it's own, pre-compiled version of the different framework TLB files are available.

Whenever the framework enters a new version, a script is run to re-generate the GUIDS on all necessary interfaces in the IDL files.

This has served us well for many years, and for us to move over the new Delphi 2009 IDL/TLB toolset will have to be not only integrated into the IDE, but also versatile when it comes to automated builds and whatnot. Can't wait to get my hands dirty with some experiments!

Upvotes: 2

Toby Allen
Toby Allen

Reputation: 11213

We have also just installed Delphi 2009 and it does seem to have improved the support for Typelibraries. However I have worked with COM and type libraries for quite some time and here are my general gotchas that I have found over the years. I would agree its pretty buggy and is all the way up to Delphi 2006 (our version prior to using 2009).

  • Always have every file writeable before opening. This may sound obvious, but when working with source control sometimes we forget to do this and try to remove readonly flag after opening a file - Delphi cant deal with this. Ensure tlb is writable before opening.
  • If editing a standalone typelibrary you MUST have a project open. For some reason if you open a type library on its own it will not save. Create a blank project and then open your typelibrary. For some reason this allows the type library to be saved.
  • If your type library is used by an application or COM+ ensure that application is shut down or COM+ disabled before opening the type library. Any open apps will prevent the type library from being saved.

However I think your best solution is probably an upgrade. You get Unicode support too.

Upvotes: 5

Barry Kelly
Barry Kelly

Reputation: 42152

In the distant past (before I started working for CodeGear) I gave up on the odd Delphi-ized IDL language that the IDE presented, and wrote my own IDL and compiled it using MS midl. This largely worked; the only catch, IIRC, was making sure dispids (id attribute) were correct on automation interfaces (dispinterfaces) for property getters & setters - there was some invariant that tlibimp expected but midl didn't guarantee.

However, now that Delphi 2009 uses a safe subset of midl syntax, and includes a compiler for this midl in the box and integrated into the IDE, these problems should be a thing of the past.

Upvotes: 8

Related Questions