Brief Index      Full Index      Events Index      I.M. Reference

Define_Exit_Handler

Functions

void Define_Exit_Handler (void(HC_CDECL *)(HC_ANY_ARGS) handler)
 
void UnDefine_Exit_Handler (void(HC_CDECL *)(HC_ANY_ARGS) handler)
 

Detailed Description

Function Documentation

void Define_Exit_Handler ( void(HC_CDECL *)(HC_ANY_ARGS handler)

Allows the program a chance to "clean up" upon termination.

Parameters
handler- Address of a new exit-handling routine. routine returning nothing

DETAILS


 
 

"Exit handlers" are subroutines called automatically as part of the standard program termination sequence. They are handy for performing functions such as marking files as possibly incomplete, freeing system resources, and sending final goodbye messages to the user.

The defined exit handlers are called (in sequence from newest to oldest) if the exit is due to a HOOPS fatal error, a call to Abort_Program() , or a call to Exit_Program() . HOOPS will also try to catch program exits that occur for other reasons, outside of HOOPS, but it may or may not be able to do that, depending on your operating system.

NOTES


 
 

If a handler calls Reset_System() (to be sure, for example, of getting a final message to the screen) the system completes the calling of the other exit handlers before doing the Reset and returning to the initial handler.

If an error or an exit occurs during the execution of an exit handler, the remaining handlers, if any, will be called. Control will not return to the exiting handler, nor will it be called recursively. Handlers can be called once per definition. It is permissible to reactivate a handler (and possibly fall into a recursion loop) by calling Define_Exit_Handler() from within the handler.

"Escaping" from an exit (by unwinding the calling stack, for example) is system-dependent and beyond the scope of this manual.

Reset_System() is defined as an exit handler during the system's startup sequence.

A warning is given for redefining an already existing handler.

RESTRICTIONS

See Also
, Define_Error_Handler, Reset_System, Abort_Program, Exit_Program, Define_System_Options.
void UnDefine_Exit_Handler ( void(HC_CDECL *)(HC_ANY_ARGS handler)

Removes all settings established by a previous call to Define_Exit_Handler().

Parameters
handler- Address of a new exit-handling routine. routine returning nothing

DETAILS

No additional details. See Define_Exit_Handler()

Brief Index      Full Index      Events Index      I.M. Reference