void * ExitProc;
Points to a program's exit procedure (provided for backward compatibility).
In Delphi code, ExitProc points to an exit procedure in an application. The exit procedure always gets called as part of a program's termination. ExitProc is only used when generating executable files.
An exit procedure takes no parameters and must be compiled with a far procedure directive to force it use the far call model.
Do not use ExitProc in a dynamically loaded package. This procedure is called when the process halts, not when a package or DLL is unloaded. If you set ExitProc from a package or DLL, it may interfere with the ExitProc of the host executable. Because ExitProc is not compatible with packages, you should add code to the finalization section of a unit. Inside a DLL, you can use the DLLProc variable instead.