Re: I cant run some TCLLib functions



Arjen,
Thanks for the reply. This is what I first suspected, but I am calling
Tcl_Init using:

if (Tcl_Init(m_interp) == TCL_ERROR) { print error messages and return }

It doesn't return TCL_ERROR. I have added some "puts" statements in int.tcl
and it is being run.

Regards,
Scott

"Arjen Markus" <arjen.markus@xxxxxxxxxx> wrote in message
news:42C3BBFF.EA148281@xxxxxxxxxxxxx
> 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


.



Relevant Pages

  • Re: Call flow - tcl - menu ivr - array as fsm? better than if?
    ... number i've dialed, execute the TCL script. ... TCL would play prompts and, in the end and if applicable, transfer the ... Router calls the tcl script that is located on a machine which is ... proc act_Setup { ...
    (comp.lang.tcl)
  • Re: Running BASH script from TCL
    ... but never exits your exec will block. ... I've a TCL script which generates some more TCL scripts (e.g. scr1.tcl ... I've an application which executes these generated TCL ... But I'm not able to execute it from the TCL script. ...
    (comp.lang.tcl)
  • Re: Problems Installing Oratcl4.1
    ... swilburn3comcarrier@hotmail.com (Scott) writes: ... >I have searched serveral newsgroups but cannot locate anyone that has ... but when I execute any oratcl commands ... >within tcl, 'invalid command name'. ...
    (comp.lang.tcl)
  • Re: How to protect database password in a interpreted program (specially Tcl)
    ... I've been building database software in Tcl but I still have some ... username and password. ... access the source code and see the line [set thepassword foo]. ... The compiled Tcl script will still run exactly the same by the ...
    (comp.lang.tcl)
  • TCL calls a c++ programm
    ... Take the C++ program for the main program and call the tcl script in it ... script calls the incrInteger-Function and then the getInteger-Function again ...
    (comp.lang.tcl)