Hi to all, I'm new to this forum and to this programming language...
i've got a problem with my thesis, I'm working with NS-2 and i need to bind an array of integers between TCL and C++... i think i have a problem on C++ side, i don't know the correct syntax...
I did like this, into the .h file i've declared the array, called seq_ like this:
int seq_[];
as a public array
into the .cc file i'm trying to bind it:
bind("seq_", seq_);
the array's name is the same in both TCL and C++ sides.
Notice that each element of the list is a Tcl_Obj. That means that the integers in your array must also be converted to Tcl_Objs before you can append them. Do that with the Tcl_IntObj functions: http://www.tcl.tk/man/tcl8.5/TclLib/IntObj.htm
Now all you need are two functions to reconcile your C++ integer array with the Tcl integer object list; one to copy the array to the list, and the other to copy the list to the array.