callbacks from C/C++ 
Author Message
 callbacks from C/C++

Hi,

We are planning to use SWIG to call C methods from Tcl/Tk script.
What is the best way to invoke callbacks from C methods to Tcl/Tk procedures?
Does SWIG support callbacks?

Thanks,
Hiren

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.*-*-*.com/ ;     Search, Read, Discuss, or Start Your Own    



Sat, 04 Aug 2001 03:00:00 GMT  
 callbacks from C/C++

Quote:

> Hi,

> We are planning to use SWIG to call C methods from Tcl/Tk script.
> What is the best way to invoke callbacks from C methods to Tcl/Tk procedures?
> Does SWIG support callbacks?

SWIG will write the main program code for you.  You can put code
into the %init block to save the interpreter pointer (interp).
From your C code, you can then call Tcl_Eval(interp,"command");

Bob

--

Mayo Foundation                                           (507) 284-2702
Rochester MN, 55905 USA   http://www.mayo.edu/sppdg/sppdg_home_page.html



Sat, 04 Aug 2001 03:00:00 GMT  
 callbacks from C/C++

Quote:


> > Hi,

> > We are planning to use SWIG to call C methods from Tcl/Tk script.
> > What is the best way to invoke callbacks from C methods to Tcl/Tk procedures?
> > Does SWIG support callbacks?

> SWIG will write the main program code for you.  You can put code
> into the %init block to save the interpreter pointer (interp).
> From your C code, you can then call Tcl_Eval(interp,"command");

Yes. Beware, though, not to do that without special care if you're
calling from another thread or from a signal handler. Do a DejaNews here
on 'AsyncMark' if you're in this case.

-Alex



Sun, 05 Aug 2001 03:00:00 GMT  
 callbacks from C/C++


Quote:

> > Hi,

> > We are planning to use SWIG to call C methods from Tcl/Tk script.
> > What is the best way to invoke callbacks from C methods to Tcl/Tk
procedures?
> > Does SWIG support callbacks?

> SWIG will write the main program code for you.  You can put code
> into the %init block to save the interpreter pointer (interp).
> From your C code, you can then call Tcl_Eval(interp,"command");

Hi, The SWIG extension will be dynamically loaded from tclsh. How do I get
the tcl interpreter in the %init bloack? As I understand, Tcl_CreateInterp
returns a new interpreter. But, we want callback to access variables from
tclsh. Is there any tcl call to get existing tclsh interpreter?

I am tcl novice, therefore this question may be trivial..

Thanks a lot for the help,
Hiren

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    



Mon, 06 Aug 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. to CS: or not to CS: in F-PC assembler

2. Camp Smalltalk (CS 6) registration

3. APL as First Language for CS

4. SoftEng or CS Graduate Program Search

5. Test and Set (TS) vs Compare and Swap (CS)

6. Refactored Plus All Missing CS ANSI Tests In SIF

7. Camp Smalltalk (CS 6) registration

8. vwnc@cs.uiuc.edu

9. Next instr of the week - CS please

10. CS Books for Sale - Many Topics

11. CS Refactoring Browser Extensions

12. How I create a new file. ( .\CS\FILENAME)

 

 
Powered by phpBB® Forum Software