|
Converts an exception into Cardinal value to be returned from DLL.
Unit
EBase
Syntax
Code (Delphi)
|
function GetExceptionErrorCode(
const AExceptObject: TObject
): Cardinal;
|
Return value
A Cardinal value to be returned to the caller - possibly via SetLastError.
Remarks
This is a helper function, which can be used to return value as GetLastError or ExitCode for thread/process.
Important!
|
Be sure to cast the returned Cardinal value to Integer when necessary! For example, old Delphi IDEs declare SetLastError/GetLastError using an Integer argument (while modern IDEs declare these function using Cardinal). The same is true when assigning the returned value to Delphi's exit codes - which use Integer as opposed to Cardinal exit codes in Windows.
|
Examples
Code (Delphi)
|
function Test: Boolean; stdcall;
begin
try
// Your actual payload (work) code should be placed here
Result := True;
except
SetLastError(GetExceptionErrorCode(ExceptObj));
Result := False;
end;
end;
|
See also
|
Send feedback...
|
Build date: 2026-09-07
Last edited: 2026-09-07
|
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/topic_function_EBase_GetExceptionErrorCode
|
|