[vtkusers] Help with tcl interpreter
    Johanna 
    pettersson.johanna at home.se
       
    Tue Jul 29 09:52:06 EDT 2003
    
    
  
This is part of my code and the result:
Code:
  Tcl_Interp *tclinterp;
  tclinterp = Tcl_CreateInterp();
  eval=Tcl_GlobalEval(tclinterp,"info library");
  if (tclinterp->result != 0) { 
    printf("Test [%s]\n", tclinterp->result);
  }
  if (eval==TCL_ERROR) {
    printf("eval=[%d]\n", eval);
    return TCL_ERROR;
  }
Result/Output:
  Test [no library has been specified for Tcl]
So I guess my libraries are not loaded ok. However I still get a TCL_ERROR from Tcl_GlobalEval so it seems that not even the line 'Tcl_GlobalEval(tclinterp,"info library")' is ok. 
I tried to do 'Tcl_EvalFile(tclinterp, "/usr/lib/tcl8.3/init.tcl")' but since all Tcl_EvalFile, Tcl_GlobalEval etc generates a TCL_ERROR I do not think it worked.
/Johanna
-----Original Message-----
From: "shahid" <shahed at isb.paknet.com.pk>
To: <vtkusers at vtk.org>
Date: Tue, 29 Jul 2003 17:24:38 +0500 
Subject: RE: [vtkusers] Help with tcl interpreter
You probably need to first check that you Interp process is initialized
properly
	code=Tcl_Eval(tclinterp,"info library"); # returned path must include path
to vtk files
                                               #else "package require vtk"
shall fail
doing
	Tcl_EvalFile(tclinterp, "your_tcllibpath/init.tcl"); # may help to
initialize the interpreter properly
Hope this shall solve your problem.
shahed
-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org]On Behalf Of
Johanna
Sent: Tuesday, July 29, 2003 12:38 PM
To: vtkusers at vtk.org
Subject: [vtkusers] Help with tcl interpreter
Hello
I am trying to use Tcl_Interp and Tcl_EvalFile to evaluate a tcl script from
a c++ file. My code looks like this:
Tcl_Interp *tclinterp;
tclinterp = Tcl_CreateInterp();
int code = Tcl_EvalFile(tclinterp, "myTclScript.tcl");
if (code!=TCL_OK) {
  return TCL_ERROR;
}
The problem is that Tcl_EvalFile is never TCL_OK and always returns an
error, i.e. myTclScript.tcl can not be evaluated. When my tcl script has
been run by the interpreter I would like to access some actors generated in
the tcl script.
Does anyone have any experience on this and can see what I am doing wrong?
Sincerely
Johanna
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
    
    
More information about the vtkusers
mailing list