O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Initializing the Extension

The widget is packaged as an extension that you can dynamically load into wish. Example 46-1 shows the Clock_Init procedure. It registers two commands, clock and oclock, which use the string-based and Tcl_Obj interfaces, respectively. It also initializes the stub table, which is described in Chapter 45, and declares a package so that scripts can load the widget with package require.

Example 46-1 The Clock_Init procedure.
 int ClockCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]); int ClockObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]); void ClockObjDelete(ClientData clientData); /* * Clock_Init is called when the package is loaded. */ int Clock_Init(Tcl_Interp ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required