I want to log some seemingly random errors I’m getting in a Delphi written COM DLL. How do I do this? Is it possible to use the Application.OnException event handler? I have control of the COM DLL source, but not the calling application.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. A DLL doesn’t have an Application variable, since it’s not an application.
The correct way to handle exceptions in a DLL is with
try..exceptblocks. The most basic technique is to put atry..exceptblock around each of your exported functions that will catch errors before they propagate outside of the DLL.You might try creating your own global function called OnException and having the Except blocks call it and pass in the exception they receive, or something like that. That’s basically what Application.OnException does; it can just do it automatically since it’s got a single known point near the bottom of the call stack to put inside a
try..exceptblock.