Accessing Global variables/objects from C code in Tcl 8.0 
Author Message
 Accessing Global variables/objects from C code in Tcl 8.0

How can one create an integer Tcl object within C code (from C procedure
A)

Tcl_NewIntObj(2),

set a variable in the global namespace pointing to that object (from the
same C procedure "A")

Tcl_Obj *ptr1, *newValue;
newValue = Tcl_ObjSetVar2(interp, ptr1, NULL, Tcl_NewIntObj(2),
TCL_GLOBAL_ONLY);
Tcl_IncrRefCount(newValue);

and then beeing able to retrieve the value of the variable, which is a
pointer to created object  (from the different C procedure "B")

Tcl_ObjGetVar2(interp, ptr1,NULL, TCL_GLOBAL_ONLY);

Whenever I tryto retrieve  variable value (i.e.pointer to the object) I
am crashing my application.
I suspect there is something wrong with setting global objects or
pointers to them ?

Andrei Oganessian



Tue, 16 Dec 2003 16:47:02 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Accessing C/C++ variables both local and global from TCL

2. access to a C global variable in tcl

3. HOW TO ???: access global variable from "C extensions" in Tcl 8.0

4. Accessing CMS global variables from 370

5. how to access global variables

6. accessing a Global variable from C in ASM

7. ?Accessing Global variables (declared in C) in ASM subroutine

8. Access a GLOBAL variable

9. Need global access to pointer variable...

10. Accessing self defined global variables within a function

11. PEP 266: Optimizing Global Variable/Attribute Access

12. Proposed PEP: Optimizing Global Variable and Attribute Access

 

 
Powered by phpBB® Forum Software