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

Invoking Scripts from C

The main program is not the only place you can evaluate a Tcl script. You can use the Tcl_Eval procedure essentially at any time to evaluate a Tcl command:

						Tcl_Eval(Tcl_Interp *interp, char *command);

The command is evaluated in the current Tcl procedure scope, which may be the global scope. This means that calls like Tcl_GetVar and Tcl_SetVar access variables in the current scope. If for some reason you want a new procedure scope, the easiest thing to do is to call your C code from a Tcl procedure used for this purpose. It is not easy to create a new procedure scope with the exported C API.

Tcl_Eval modifies its argument. ...

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