Overview
| Artifact ID: | 003aafc68370fa76af8de961dedf7c861405137d04c1c53c5f20febdbd2f629b |
|---|---|
| Ticket: | 3d768414de12dcd10aa7af36cdaca3fcdd821c4d |
| Date: | 2020-07-14 15:28:53 |
| User: | sbron |
| Artifact Attached: | 3a8a75fb6fab26b693d50606082a7ba3b2d37e5d002ffe7ac49fb55797d94223 |
| Filename: | onexit.c |
| Description: | Minimal extension that uses Tcl_CallWhenDeleted() to print a message to stderr when the interp is deleted. |
Content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19#include <tcl.h> void onexit(ClientData clientData, Tcl_Interp *interp) { fprintf(stderr, "OnExitHandler for interp %p\n", interp); } int Onexit_Init(Tcl_Interp *interp) { #ifdef USE_TCL_STUBS if (Tcl_InitStubs(interp, "8.5", 0) == NULL) return TCL_ERROR; #else if (Tcl_PkgRequire(interp, "Tcl", "8.5", 0) == NULL) return TCL_ERROR; #endif Tcl_CallWhenDeleted(interp, onexit, NULL); return Tcl_PkgProvide(interp, "onexit", "1.0"); }
