Talking about Danny Thorpe: he also posted a nice hint on threading methods for ancient Delphi versions that equally applies to DLL exports in any Delphi version, even any programming environment.
Recently, I had to do some surgery in such a Pre-Delphi 6 application, and I was really happy to remember this answer: it instantly solved some process crashes, and the added logging allowed for investigating the actual cause.
Note that this tip isn’t just a good advice for old Delphi versions.
Even in younger Delphi versions, you have to watch methods that can be called from outside a regular Delphi context, for instance exported methods.
Heck, it applies to virtually any development environment: exceptions usually are very specific to that environment and should never cross a process boundary.
Summary
Take the approach below
- for Execute methods in your own thread classes in Delphi 5 or earlier
- for any method that can be called externally (like DLL exports) Read the rest of this entry »