From: DCelso <dc...@gm...> - 2009-10-08 18:15:33
|
Hello to all, I m trying to run serveral TCL commands inside C++ source code and when I show the information of the auto_path it is empty. If I put the same command in the tclsh interpreter it runs well. What Am I doing bad? in tclsh I insert: puts $auto_path puts hola package require Tk and runs well. my c souce code is the next: #include <tcl.h> #include <stdlib.h> int main(int argc, char**argv) { Tcl_Interp *interp; int status; char *comandos[] = { "puts $auto_path","set auto_path /usr/lib/","puts $auto_path","auto_load","puts hola", "package require Tk", "package require clock", , "", NULL }; interp = Tcl_CreateInterp(); if (interp == NULL) { printf("can not create tcl interpreter\n"); exit(EXIT_FAILURE); } int i = 0; Tcl_Obj *obj; while (comandos[i] != NULL) { status = Tcl_Eval(interp, comandos[i]); if (interp->result[0] != 0) { printf("%s\n", interp->result); } i++; } return EXIT_SUCCESS; } The result of the execution is: can't read "auto_path": no such variable /usr/lib/ /usr/lib/ invalid command name "auto_load" hola can't find package Tk can't find package clock can't find package AglClient -- View this message in context: http://www.nabble.com/bug-using-TCL--command-%22package-require%22--embedded-in-C-tp25803376p25803376.html Sent from the tcl-bugs mailing list archive at Nabble.com. |