Previous: CmdShow variable To the Table of Content Next: ExeName variable

- 4.62.1.6 -
Standard Units
System Unit
System Unit Variables

ErrorAddr variable

Targets: MS-DOS, OS/2, Win32


System Unit

ExitProc, ExitCode, and ErrorAddr variables are used to implement exit procedures.

The ExitProc pointer variable allows one to install an exit procedure. The exit procedure always gets called as part of a program's termination.

An exit procedure takes no parameters and must be compiled with a far procedure directive to force it to use the far call model.

When implemented properly, an exit procedure actually becomes part of a chain of exit procedures. The procedures on the exit chain get executed in reverse order of installation.

To keep the exit chain intact, you must save the current contents of ExitProc before changing it to the address of your own exit procedure.

The first statement in your exit procedure must reinstall the saved value of ExitProc.

An exit procedure may learn the cause of termination by examining the ExitCode integer variable and the ErrorAddr pointer variable. The last exit procedure (the one installed by the run-time library) closes the Input and Output files. If ErrorAddr is not nil, it outputs a run-time error message.


Previous: CmdShow variable To the Table of Content Next: ExeName variable
CmdShow variable Table of Content ExeName variable

- 4.62.1.6 -