Re: I cant run some TCLLib functions
- From: Arjen Markus <arjen.markus@xxxxxxxxxx>
- Date: Thu, 30 Jun 2005 11:31:43 +0200
Scott Brown wrote:
>
> 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
The file package.tcl defines the pkgUnknown procedure and others.
I think you forgot the call to Tcl_Init() - this will load all the
initial scripts, a.o. package.tcl.
Regards,
Arjen
.
- Follow-Ups:
- Re: I cant run some TCLLib functions
- From: Scott Brown
- Re: I cant run some TCLLib functions
- References:
- I cant run some TCLLib functions
- From: Scott Brown
- I cant run some TCLLib functions
- Prev by Date: Re: panedwindows?
- Next by Date: capture avoidance
- Previous by thread: I cant run some TCLLib functions
- Next by thread: Re: I cant run some TCLLib functions
- Index(es):
Relevant Pages
|