From Appmethod Libraries
Jump to: navigation, search

Object Pascal

ExitCode: Integer = 0;    { Program result }


extern DELPHI_PACKAGE int ExitCode;


Type Visibility Source Unit Parent
variable public
System System


Contains the application's exit code.

In Object Pascal code, the ExitCode variable contains the application's exit code. An exit procedure can learn the cause of termination by examining ExitCode. If the program terminates normally, ExitCode is zero. If the program terminates due to a call to Halt, ExitCode contains the value passed to Halt. If the program terminates due to a run-time error, ExitCode contains the error code.

Note: Setting the ExitCode variable to a value other than 0 in the initialization section of a unit will make loading of a DLL fail (DllMain will return False). You can also set ExitCode in code called from DLLProc or DLLProcEx to signal failure of loading.

See Also