Exceptions and DLL in Delphi

后端 未结 4 1953
心在旅途
心在旅途 2020-12-19 13:05

What is the right way to handle exceptions thrown from inside a DLL in Delphi?

Something like this

on E : ESomeException do ...

or<

4条回答
  •  生来不讨喜
    2020-12-19 13:39

    If you use runtime packages (at least rtlxx.bpl) for both your application and your dll, then both have the same type and it will work. Of course this limits the use of your dll to Delphi/BCB only.

    Another solution is not using exceptions at all like Deltics suggest. Return error codes.

    Or use COM. Then you can have exceptions and not limit your dll to Delphi only.

提交回复
热议问题