Integrate cplusplus with tcl script? 
Author Message
 Integrate cplusplus with tcl script?

The process core dump when executing "34:Tcl_DeleteInterp(interp);"?
the codeo
----------------------------------------------------------------
01:Tcl_Interp *interp ;
02:char temp[256];
03:this->setSuccess(true);
04:this->setOutParams("");
05:interp = Tcl_CreateInterp() ;
06:int result = 0 ;
07:int ret = Tcl_Init( interp );
08:if(ret != TCL_OK){
09:    Tcl_DeleteInterp(interp);
10:    msg.set_errorMsg( "Unable to Initialize Tcl!" );
11:    return -1 ;
12:}
13:Tcl_CreateCommand( interp, "CReturn", scriptReturn,
(ClientData)this,(Tcl_CmdDeleteProc *)NULL );
14:Tcl_CreateCommand( interp, "CReturnError", scriptReturnError,
(ClientData)this,(Tcl_CmdDeleteProc *)NULL );
15:CStringList paramList ;
16:int num = base_divide_str(params," ",&paramList);
17:string script = "set argc "+itoa(num)+";set argv {"+params+"};";
18:LogAppend(DEBUG_LEVEL,"DebugInfo",script.c_str());
19:ret = Tcl_Eval(interp,script.c_str());
20:if(ret == TCL_ERROR){
21: sprintf(temp,"line=%d,info=%s",interp->errorLine,interp->result);
22: msg.set_errorMsg(string(temp));
23: result = -2 ;
24:}else {
25: string hints("fileName = " +fileName);
26: LogAppend(DEBUG_LEVEL,"DebugInfo",hints.c_str());
27: ret = Tcl_EvalFile(interp,fileName.c_str());
28: if(ret == TCL_ERROR){
29:
snprintf(temp,strlen(temp)-1,"line=%d,info=%s",interp->errorLine,interp->result);
30:  msg.set_errorMsg(string(temp));
31:  result = -3 ;
32: }
33:}
34:Tcl_DeleteInterp(interp);
----------------------------------------------------------------
The above code run with Thread,There are messages when debug the core fileo

Segmentation fault in Ptr2Block at 0xd3375ef8 ($t8)
0xd3375ef8 (Ptr2Block+0x10) 7ce320ae       lbzx   r7,r3,r4
(dbx) where
Ptr2Block() at 0xd3375ef8
TclpFree() at 0xd33764d8
Tcl_Free() at 0xd3375a14
FreeFsPathInternalRep() at 0xd33b84b4
TclDeleteVars() at 0xd337b66c
TclTeardownNamespace() at 0xd3374c78
DeleteInterpProc() at 0xd33850f8
Tcl_EventuallyFree() at 0xd3379258
Tcl_DeleteInterp() at 0xd3389500
executeFile(std::basic_string<char,std::char_traits<char>,std::allocator<char>
 >&,std::basic_string<char,std::char_traits<char>,std::allocator<char>
 >&,CBSErrorMsg&)(0x301358e0, 0x301358f8, 0x30135908, 0x301358a0), line 107
in "TclScriptContainer.cpp"
BackupClient._Nullstr()(), line 458 in "xstring"
.() at 0x0
BackupClient::initConfig(int,char**)(this = (nil), argc = 0, argv =
0xf09fdf34), line 119 in "BackupClient.cpp"
pthread_startRoutine(void*)(0x30020588), line 59 in "Thread.cpp"

Appreciate for your help.

Thanx.



Sat, 27 Sep 2008 13:12:26 GMT  
 Integrate cplusplus with tcl script?

Quote:

> The process core dump when executing "34:Tcl_DeleteInterp(interp);"?
> the codeo

Does your program call Tcl_FindExecutable() early in its run?

If not, do so, and that may take care of it.

If so, file a bug report with more details (like version of Tcl you
are using) at the SF Tracker for Tcl.  

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Sat, 27 Sep 2008 20:05:04 GMT  
 Integrate cplusplus with tcl script?
The process crash at sometimes ,not always.


Quote:

>> The process core dump when executing "34:Tcl_DeleteInterp(interp);"?
>> the codeo

> Does your program call Tcl_FindExecutable() early in its run?

> If not, do so, and that may take care of it.

> If so, file a bug report with more details (like version of Tcl you
> are using) at the SF Tracker for Tcl.

> --
> | Don Porter          Mathematical and Computational Sciences Division |

> | http://math.nist.gov/~DPorter/                                  NIST |
> |______________________________________________________________________|



Sun, 28 Sep 2008 17:37:17 GMT  
 Integrate cplusplus with tcl script?

Quote:

>>> The process core dump when executing "34:Tcl_DeleteInterp(interp);"?
>>> the codeo


Quote:
>> Does your program call Tcl_FindExecutable() early in its run?

>> If not, do so, and that may take care of it.

>> If so, file a bug report with more details (like version of Tcl you
>> are using) at the SF Tracker for Tcl.

> The process crash at sometimes ,not always.

You did not answer the question.

--
| Don Porter          Mathematical and Computational Sciences Division |

| http://math.nist.gov/~DPorter/                                  NIST |
|______________________________________________________________________|



Sun, 28 Sep 2008 22:04:23 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. newbie:integrating tcl/tk scripts with C

2. Port TCL script to Wish Can't find variable contents from tcl script

3. Executing Tcl script inside a Tcl script

4. calling a tcl script form another tcl script

5. tcl script to edit tcl script

6. Tcl script exec'd from VMS tcl script doesn't display puts o/p

7. NEED HELP On integrating C and Tcl modules under twine (Tcl/Tk for MS Windows)

8. Subject: NEED HELP On integrating C and Tcl modules under twine (Tcl/Tk for MS Windows)

9. NEED HELP On integrating C and Tcl modules under twine (Tcl/Tk for MS Windows)

10. NEED HELP On integrating C and Tcl modules under twine (Tcl/Tk for MS Windows)

11. NEED HELP On integrating C and Tcl modules under twine (Tcl/Tk for MS Windows)

12. NEED HELP On integrating C and Tcl modules under twine (Tcl/Tk for MS Windows)

 

 
Powered by phpBB® Forum Software