Re: Design question: C command calling back into Tcl



Why not split your application into two halves. The Tcl/Tk process for
displaying and triggering the data. The C process half for doing the
capture.

To connect those two I would suggest a straightforward messaging scheme
such as shared memory (as used by the SIMPL project at
https://sourceforge.net/projects/simpl)

bob


Helmut Giese wrote:

> Hello out there,
> I have the following requirements:
> - From a Tcl script I invoke a command written in C.
> - This command produces lots of data.
> - I would like to receive each of these data items at the moment it is
> produced.
>
> My idea was to use the concept of linked variables:
> - The C code puts the data into a C variable which is linked to a Tcl
> variable and then calls Tcl_UpdateLinkedVar.
> - The respective Tcl variable has a write trace which, when activated,
> will get the current data item and store it somewhere else (since it
> will be overwritten from the C side when the next item arrives).
>
> Is this approach feasible? I am asking, because I get mysterious
> crashes. Maybe this whole concept is wrong. What happens is
> - Tcl interpreter calls C command
> - C command calls Tcl_UpdateLinkedVar which triggers a trace in the
> same interpreter.
>
> This is some sort of recursion involving the same interpreter. Can
> this be made to work or is this design just plainly wrong?
> Any insight is greatly appreciated.
> Best regards
> Helmut Giese

.



Relevant Pages

  • ANN: AOLserver 4.5.0 released!
    ... On behalf of the AOLserver Team, I have the honor of announcing the ... AOLserver 4.5.0 is a major upgrade including several new Tcl commands, ... AOLserver is America Online's Open-Source web server. ... the "ns_zlib" command for compressing and uncompressing ...
    (comp.lang.tcl)
  • Tcl-URL! - weekly Tcl news and links (Mar 5)
    ... GRIDPLUS2 is a Tile based version of GRIDPLUS. ... *) New "gpselect" command to select a tablelist row or tree node. ... Some people take their license issues very personal indeed;-) (and ... Word documents via Tcl and tcom - ...
    (comp.lang.tcl)
  • Re: Core commands as ensembles...
    ... command that does much the same as [namespace code], ... TCL as their scripting/console engine. ... home-brew bits and pieces, in which I will use TCL in any way that I ...
    (comp.lang.tcl)
  • Re: Can Ruby read emails?
    ... command, and Ruby will read it and exacute that command. ... I actually wrote a system using Tcl some years back which used ... e-mail to "move" a software agent from one host to another. ...
    (comp.lang.ruby)
  • Re: ANNOUNCE: tcgd - modern, nearly feature-complete interface to gd-2 graphics drawing
    ... This style of Tcl_Obj management is something that some Tcl core developers ... Tcl_Obj command might work better, ... Hmm, Itcl incremements an integer, "unique", for each object generated ... until it finds an command name that doesn't exist, though, wraparound ...
    (comp.lang.tcl)

Loading