well Robert, this helps! thank you very much for your valuable answer. I have found something similar, but I used to think that it looked like a "trick". I sent the result to a tcl implemented function returning its argument, something like: proc return_result { result} { return result }
then in my function defined in myAgent::command, I use : tcl.evalf("return_result %ld", my_result); and I notice that the result returned by the function defined in myAgent::command is what I want! I am quite surprised that I cannot find anyhing simpler. Regards, Gilles Bertrand 2006/5/24, Robert Luke <[EMAIL PROTECTED]>: > > Gilles, > > I am away from my code right now but I recently did something similar. > I put the Tcl command being sent back over to the interpreter side in > a string instead of a long. I also used tcl.eval() instead of > tcl.resultf(). (Keeping my fingers crossed that my memory is > accurate...) > > Hope this helps, > -Robert > > > On 5/24/06, Gilles Bertrand <[EMAIL PROTECTED]> wrote: > > > > Dear NS users, > > > > I have implemented an new tcl instruction "get_stat". This function is > > implemented in C++ thanks to "my_Agent::command" function. I store a > result > > in a variable "long my_result" and would like to transmit this value > back to > > my TCL script. I therefore use the following instruction: tcl.resultf > ("%ld", > > my_result). > > > > But when I use the result returned in tcl it is always an empty string, > even > > if I test with something like tcl.resultf("10.0"). How comes? > > > > I would be very grateful if anyone can help me to get rid of this bug. > > > > Mit freundlichen Grüßen, with kind regards, cordialement, > > > > ---------------------------------------------------------- > > Gilles BERTRAND > > Telecom INT - University of Stuttgart > > ---------------------------------------------------------- > > >