RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.ExitCode Variable

Contains the application's exit code.

Pascal
ExitCode: Integer = 0;
C++
int ExitCode = 0;

In Delphi 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 runtime error, ExitCode contains the error code.

Note: On Windows, 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.
Note: On Linux, although the ExitCode variable is accessible from shared object code, its value does not affect the loader of the shared object. Thus, using ExitCode in a shared object has no effect.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!