1
votes

I am working on a project need Tclsh like support with some self-defined commands. I implemented following code (based on Tcl 8.5):

Tcl_Main(argc, argv, Tcl_AppInit);

And put new commands registration in Tcl_AppInit. Everything looks fine, except that with the new command line interpreter, when I type Tcl built-in command "history", I got :

% history
invalid command name "history"

Other built-in commands work fine, like "puts", "set", etc. Why ? Do I have to implement my own "history" command instead?

1
Solved the mystery : It turns out "history" is part of Tcl script library which needs to be sourced during initialization, either by sourcing $TCL_LIBRARY/init.tcl or calling Tcl_Init(interp).n.x.
You may add this comment as a answer and accept it—that's a normal practice on SO: there's nothing wrong with the fact you solved this yourself ;-)kostix

1 Answers

2
votes

Add my solution here: It turns out history is part of Tcl script library which needs to be sourced during initialization, either by sourcing $TCL_LIBRARY/init.tcl or calling Tcl_Init(interp).