Root > Advanced topics > Using EurekaLog in DLL > What is the proper way to handle exceptions in DLL

What is the proper way to handle exceptions in DLL

Previous pageReturn to chapter overviewNext page   

As you should already understood by now: rule #1 when working with exceptions in DLLs is "never let exception escape DLL". That because caller may not know how to work with exception object generated by different programming language. For example, a Delphi .exe file have no idea to to read exception message from Microsoft C++ exception; it doesn't know how to properly release exception object after exception is handled. Therefore, all exceptions in DLL functions must be captured and handled by translating them to error code or other error signature as required by DLL API.

 

How this should be done? That highly depends on what your DLL API is. This also depends on what framework you do use. There are 3 possible cases:

1. You develop DLL by using a framework. For example: you write a control panel applet by using VCL. Or you write ISAPI module by using IntraWeb.
2. You develop DLL for already established API without using a ready framework. For example: you write a plugin for 3rd party application (like Total Commander). Or you write a global system hook (which requires DLL).
3. You develop both DLL and API specification. For example: you write your own DLL to be used by different applications.

 

See also: Creating bug reports for DLL exceptions.

 

Note: if you develop DLL that will only be used in executable compiled in exactly the same version of the compiler, and you want to pass exceptions between modules for simplicity - see this article.

 

 

See also:

 




Send feedback... Build date: 2019-02-25
Last edited: 2019-01-09
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/dll_proper_way_handle_exception.php