2.7g in DLL

delphi package - automated exception handling
Post Reply
michaelyeo
Posts: 2
Joined: Wed Mar 22, 2006 3:34 pm

2.7g in DLL

Post by michaelyeo »

I have a DLL written in Delphi 7, which SQL Server calls to run some functions. I enabled MadExcept to handle exceptions, together with the option to log exceptions.

However, I can't seem to get MadExcept to work correctly. If I raise an error manually in the DLL e.g.

raise EOutOfMemory.Create('Test');

MadExcept does not catch the exception. Instead, SQL Server catches the exception and reports it.

I'm using 2.7g. Should I use version 3 instead? We're currently sticking to 2.7g as it's working for our regular exes'. Thanks.

Mike
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Pleaes check out the first paragraph on this page:

http://help.madshi.net/HowToUseMadExcept.htm

The problem is quite simple: Exceptions are generally passed back to the next try..except frame. If the thread jumps into your dll and crashes there, and if in the callstack there's no try..except block inside of your dll, the SQL server will take care of the exception. So you have to add a try..except block to all code that can be called from outside.
michaelyeo
Posts: 2
Joined: Wed Mar 22, 2006 3:34 pm

Post by michaelyeo »

Thanks. I was so used to getting it to work without any code in the exe that I forgot it needed some work in the dll.
Post Reply