[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Tcl command returned bad code error



Hi,

I'm having problems running my test scripts through my version of ns. The
problem that occurs appears to be some kind of low level tcl problem: the
return value from the tcl interpreter appears to be invalid and I get the
very cryptic "command returned bad code" error.

I've been working on this for a couple of days and I can't seem to pin
down the problem - I guess this can be attributed to the fact that I'm not
very clued in on tcl. I decided to upgrade my tcl interpreter hoping that
the problem would go away before I started digging around in the tcl
source code, but to no avail. (Incidentally, I've got some notes on how to
compile ns-2.1b6 with tcl 8.3.1 - only a couple of small changes are
necessary - I'll put them on the web once I've run validate fully for the
resulting binary).

Upgrading to tcl 8.3.1 did cause a slight behavioural change - now instead
of printing the "command returned bad code" error, it simply stops and
prints out the result obtained from calling a particular tcl function.

I could give details on what exactly my script is trying to do and how
I've modified ns, but I think that this would require quite a bit of
detailed explanation and I'm not so sure that it would be very
illuminating. What is important, however (I think), is that I'm nesting
tcl and c++ and tcl; so, for example, I run the tcl script and this calls
some c++ code (using $objname cmd command-name params). This c++ function
then calls tcl.eval() to evaluate some more (O)tcl code and this is where
the problem arises.

I was wondering if anyone has observed this problem before - if so, what
caused it and how was it solved? I was thinking that it may be to do with
the fact that tclcl uses Tcl_GlobalEval and that this does not permit such
nesting but calling tcl from c++ seems to be performed in many places, so
now I don't think that this is the problem.

Any pointer/hints/tips appreciated.

Regards,
Sean.

-----
Sean Murphy,			Email: [email protected]
Teltec Ireland,			Phone: +353-1-7045080
DCU, Dublin 9,			Fax:   +353-1-7045092
Ireland.