Problem with Tcl_SetResult and Tclkit under Windows
Gerard Durand <[email protected]> Tue, 12 Apr 2011 14:18:10 +0000 (UTC)
| Newsgroups | gmane.comp.lang.tcl.starkit |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I'm trying to return a long chain from C to Tcl.
If I use :
sprintf(interp->result,"%s",Message) ; with Message containing my character
chain, it works. But Message can not be more than 200 characters long
(TCL_RESULT_SIZE limit).
Normally the solution is to use Tcl_SetResult (and it will be the only one with
tcl 8.6 I think ! even for short strings) :
Tcl_SetResult(interp,Message,TCL_VOLATILE);
Like that, it works on Linux, it works too on Windows if my tcl code calls
directly my compiled C code inside a dll. But it does not work if my dll is
included in a kit (though the 1st solution with sprintf is OK, except when my
Message is too long of course).
I use tclkit and tclkitsh 8.5.9 on Windows XP and my compiler is gcc (TDM 4.5.2
version on Windows).
I have tried others solutions like :
Tcl_SetVar(interp,"v1_out",Message,TCL_GLOBAL_ONLY);
or :
Tcl_Obj * ResultObj ;
ResultObj = Tcl_NewStringObj(Message,-1);
Tcl_SetObjResult(interp,ResultObj);
It's always OK when my tcl code calls directly the dll, but never work when It's
inside a kit. I obtain this error :
Microsoft Visual C++ Runtime Library
Runtime Error !
This application has requested the Runtime to terminate it in an unusual way, ...
Apparently, I have not such problems under Linux and tclkit (though versions are
a little bit different).
So, what is wrong ?
Thanks for your help.
Gerard
--
You received this message because you are subscribed to the "starkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/starkit?hl=en