Tcl_Exit(3) Tcl Library Procedures Tcl_Exit(3)_________________________________________________________________NAME
Tcl_Exit, Tcl_CreateExitHandler, Tcl_DeleteExitHandler -
end the application (and invoke exit handlers)
SYNOPSIS
#include <tcl.h>
Tcl_Exit(status)
Tcl_CreateExitHandler(proc, clientData)
Tcl_DeleteExitHandler(proc, clientData)
ARGUMENTS
int status (in) Provides information
about why applica-
tion exited. Exact
meaning may be plat-
form-specific. 0
usually means a nor-
mal exit, 1 means
that an error
occurred.
Tcl_ExitProc *proc (in) Procedure to invoke
before exiting
application.
ClientData clientData (in) Arbitrary one-word
value to pass to
proc.
_________________________________________________________________DESCRIPTION
Tcl_Exit is the procedure that is invoked to end a Tcl
application. It is invoked by the exit command, as well
as anyplace else that terminates the application. No-one
should ever invoke the exit procedure directly; always
invoke Tcl_Exit instead, so that it can invoke exit han-
dlers.
Tcl_CreateExitHandler arranges for proc to be invoked by
Tcl_Exit before it terminates the application. This pro-
vides a hook for cleanup operations such as flushing
buffers and freeing global memory. Proc should have argu-
ments and return value that match the type Tcl_ExitProc:
typedef void Tcl_ExitProc(ClientData clientData);
The clientData parameter to proc is a copy of the client-
Data argument given to Tcl_CreateExitHandler when the
callback was created. Typically, clientData points to a
data structure containing application-specific information
Tcl 7.5 1
Tcl_Exit(3) Tcl Library Procedures Tcl_Exit(3)
about what to do in proc.
Tcl_DeleteExitHandler may be called to delete a previ-
ously-created exit handler. It removes the handler indi-
cated by proc and clientData so that no call to proc will
be made. If no such handler exists then Tcl_DeleteEx-
itHandler does nothing.
KEYWORDS
callback, end application, exit
Tcl 7.5 2