◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back► ─────Run-Time Library─────────────────────────────────────────────────────── The atexit and _onexit functions are passed the address of a function (<func>) to be called when a program terminates normally. Successive calls to either function create a register of functions that are executed in LIFO (last-in─first-out) order; no more than 32 functions can be registered. The functions passed to atexit and _onexit cannot take parameters. For DOS32X, atexit and _onexit use the heap to hold the "register of functions." Thus, the number of functions that can be registered is limited only by heap memory. The _fatexit and _fonexit functions are far versions of atexit and _onexit, respectively. They can be used with any memory model. Return Value Both atexit and _fatexit return 0 if successful, or a nonzero value if an error occurs (e.g., if there are already 32 exit functions defined). Both _onexit and _fonexit return pointers to the function if successful, and return NULL if there is no space left to store the function pointer. -♦-