atexit()

specify function to be called when program terminates 

Function


SYNOPSIS

#include <stdlib.h>

int atexit(void (*func)(void));


DESCRIPTION

The atexit() function adds the function func to a list of functions to be called without parameters on normal termination of the program. Normal termination occurs by either a call to exit() or a return from main(). The functions are called in the reverse order of their registration.


PARAMETERS

func 

Identifies the function to be called at program exit.


RETURN VALUES

The atexit() function returns zero if the registration is successful, non-zero if it fails.


CONFORMANCE

ANSI/ISO 9899-1990, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

Each DLL has its own list of atexit() handlers. These handlers are run when the DLL is unloaded, whether dynamically (via dlclose()) or at process exit. This ensures that DLLs clean up properly when they are dynamically loaded and unloaded. Refer to Windows Concepts and Porting Shared Libraries in the PTC MKS Toolkit UNIX to Windows Porting Guide for more information


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
exit()


PTC MKS Toolkit 10.3 Documentation Build 39.