Don Porter wrote:
> Your AppInit routine should call Tcl_Init().
Duh. Yes, I was missing that. It's still not quite the same as invoking
Tclsh though...
If I use Tcl_AppInit to call Tcl_EvalFile, then after the EvalFile
returns, Tcl_Main tries to invoke argv[1]. I.e., if I call
invoke one two three four
I get
AppInit: buf=uplevel #0 {source Invoke.tcl}
Invoked invoke.tcl <- (Here on down is from the Invoke.tcl script.)
Argc = 3
Argv = two three four
Argv0 = one
auto_path = /usr/share/tcl/tcl8.4 /usr/share/tcl /SkyClix/src/lib/lib
/usr/lib
<- Here on down is from the C code again.
couldn't read file "one": no such file or directory
make: *** [test] Error 1
With just tclsh Invoke.tcl one two three four, I get
Invoked invoke.tcl
Argc = 4
Argv = one two three four
Argv0 = Invoke.tcl
auto_path = /usr/share/tcl/tcl8.4 /usr/share/tcl /usr/lib
Note the lack of any extraneous /SkyClix/src/lib/lib in auto_path,
and that "one" actually gets passed in argv.
Using the TclSetStartupScriptFileName trick, I get the same thing
as the first output above, except without the "can't find one" on
return.
Is the easiest solution to simply build a new argv[] in C and put a
dummy script name in front or something? I'll give that a try next. I'd
prefer not to get arbitrary directories plugged into the auto_path, but
I'm willing to kludge around that if necessary.
--
Darren New / San Diego, CA, USA (PST)
His kernel fu is strong.
He studied at the Shao Linux Temple.