Name
SafeCallErrorProc Variable
Syntax
var SafeCallErrorProc: Pointer; procedureSafeCallError(ErrorCode: Integer; ErrorAddr: Pointer); begin ... end; SafeCallErrorProc := @SafeCallError;
Description
Delphi calls the procedure that
SafeCallErrorProc points to when a
safecall routine returns an
HResult that indicates an error. If
SafeCallErrorProc is nil, or if
the procedure does not raise an exception (so it returns normally),
Delphi reports runtime error 24
(ESafeCallException).
Tips and Tricks
The
ComObjunit sets this variable to a procedure that tries to getIErrorInfoinformation, and raise anEOleExceptionexception using theErrorCodeandIErrorInfodata.When you implement a COM server in Delphi, any Delphi exceptions raised in a
safecallmethod are handled by the object’sSafeCallExceptionmethod and mapped to anHResult. TheSafeCallErrorProcprocedure is called only for runtime errors and non-Delphi exceptions.
See Also
| Function Keyword, Interface Keyword, Procedure Keyword, Safecall Directive, TObject Type |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access