I cant run some TCLLib functions
- From: "Scott Brown" <None@xxxxxxxxxxxx>
- Date: Wed, 29 Jun 2005 15:48:18 -0700
Hello,
I have a TCL 8.4 interpreter embedded in my windows application. The
standard commands (set, lappend, etc) work fine. I can get some of the
library commands to work but most of them do not work. I would greatly
appreciate any help you can provide. Here are some specifics:
I create the interpreter using:
Tcl_FindExecutable("D:\MyProgram\Server\bin\MAServer.exe");
m_interp = Tcl_CreateInterp();
if ( m_interp == NULL ) { print error messages and return }
Tcl_SetVar2(m_interp , "env", "TCL_LIBRARY",
"D:/MyProgram/Server/TCL84Lib/TCL8.4", TCL_GLOBAL_ONLY);
Tcl_SetVar2(m_interp , "env", "TCLLIBPATH",
"D:/MyProgram/Server/TCL84Lib/TCL8.4", TCL_GLOBAL_ONLY);
Tcl_SetVar(m_interp, "argv0", "", TCL_GLOBAL_ONLY); //Needed to
make ::math::statistics::mean work!
if (Tcl_Init(m_interp) == TCL_ERROR) { print error messages and
return }
To test the libraries I try to run the following TCL script, (which works
fine in tclsh)
package require math::statistics;
puts "Mean = [::math::statistics::mean {1 2 3}]";
but I get the following message:
invalid command name "tclPkgUnknown"
while executing
"tclPkgUnknown math::statistics {}"
("package unknown" script)
invoked from within
"package require math::statistics"
(procedure "__SampleMacro" line 1)
Then I discovered that the following TCL does work:
source "[info library]/package.tcl";
package require math::statistics;
puts "Mean = [::math::statistics::mean {1 2 3}]";
I don't understand why I need to source the package.tcl file, but I can live
with this workaround. This is probably a clue to the source of my problems.
My next test was to try a different one of the math functions (part of the
math package, not math::statistics):
source "[info library]/package.tcl";
package require math;
puts "StdDev = [::math::sigma 1 2 3 4]";
but now I get the following message
invalid command name "::math::sigma"
while executing
"::math::sigma 1 2 3 4"
Seems like there is something wrong with my environment, path etc.
I would greatly appreciate any help you can give. I have been trying to
solve this problem on and off for 2 weeks.
Thanks,
Scott
.
- Follow-Ups:
- Re: I cant run some TCLLib functions
- From: Schelte Bron
- Re: I cant run some TCLLib functions
- From: Arjen Markus
- Re: I cant run some TCLLib functions
- Prev by Date: tcl and *.dvi files
- Next by Date: Having problem with SPLIT
- Previous by thread: tcl and *.dvi files
- Next by thread: Re: I cant run some TCLLib functions
- Index(es):
Relevant Pages
|