When I invoke Tcl_EvalFile in my program with MFC, I got a error "child process exited abnormally".

Posted by bitlgy on 2011-03-23 20:25

My program is built by MFC, it have a GUI not a console window. I create a tcl interpreter by invoking Tcl_CreateInterp in my program. When use this interpreter to invoke Tcl_EvalFile, if there is "package require XXX" in the script, the interpreter will return a error "child process exited abnormally". I don't know what reason to cause this problem. Anyone can provide some suggestion? Thanks a lot!

void CMyTcl::CreateTclInterp()
char path[MAX_PATH];

mpTclInterp = Tcl_CreateInterp();




void CMyTcl::ExecScript(CString filepath)
int code;
const char* result;

code = Tcl_EvalFile(mpTclInterp,(char *)filepath.GetBuffer(filepath.GetLength()));
result = Tcl_GetStringResult(mpTclInterp);

CString strRst;
if ( code != TCL_OK )
AfxMessageBox(("Error:" + strRst));



PS: when I firstly run program, system popup a console window with "Routing and Remote access service is starting up" and program run successfully. but I secondly run program, tcl interpreter will return a error "child process exited abnormally". Do I need to invoke some API of tcl to make some settings?