I cant run some TCLLib functions



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


.



Relevant Pages

  • Re: Managing reusable code for multiple Tcl applications
    ... it is very similar to various issues we overcame with Tcl Dev Kit or related apps. ... We have some mid-size applications (couple of thousand ... up auto_path appropriately to locate the reusable libraries. ... This all works wonderfully until distribution time, ...
    (comp.lang.tcl)
  • Re: Porting from other UNIX platforms to Linux (64bit)
    ... > Does your application currently work in 64 bit environments? ... no - our application started originally with tcl 7.0 and the GUI ... external tcl extending libraries like togl. ... For builds on Linux, we are due to the missing company wide build ...
    (comp.lang.tcl)
  • Re: Managing reusable code for multiple Tcl applications
    ... I have introduced Tcl to my company and we now use it quite ... We have some mid-size applications (couple of thousand ... up auto_path appropriately to locate the reusable libraries. ... This all works wonderfully until distribution time, ...
    (comp.lang.tcl)
  • Managing reusable code for multiple Tcl applications
    ... I have introduced Tcl to my company and we now use it quite ... We have some mid-size applications (couple of thousand ... up auto_path appropriately to locate the reusable libraries. ... This all works wonderfully until distribution time, ...
    (comp.lang.tcl)
  • Re: apache rivet: configure.tcl and make.tcl missing from distribution
    ... # -D flags for use with the C compiler. ... # If TCL was built with debugging symbols, ... # this string at the end of the library name. ... # Flag to indicate whether shared libraries need export files. ...
    (comp.lang.tcl)