manpagez: man pages & more
info gawk
Home | html | info | man

gawk: Exit Callback Functions Registering An Exit Callback Function
 An "exit callback" function is a function that 'gawk' calls before it
 exits.  Such functions are useful if you have general "cleanup" tasks
 that should be performed in your extension (such as closing database
 connections or other resource deallocations).  You can register such a
 function with 'gawk' using the following function:
 'void awk_atexit(void (*funcp)(void *data, int exit_status),'
 '                void *arg0);'
      The parameters are:
           A pointer to the function to be called before 'gawk' exits.
           The 'data' parameter will be the original value of 'arg0'.
           The 'exit_status' parameter is the exit status value that
           'gawk' intends to pass to the 'exit()' system call.
           A pointer to private data that 'gawk' saves in order to pass
           to the function pointed to by 'funcp'.
    Exit callback functions are called in last-in, first-out (LIFO)
 order--that is, in the reverse order in which they are registered with
© 2000-2018
Individual documents may contain additional copyright information.