n.x.
n.x.

Reputation: 31

Missing built-in command "history" for Tcl C extension

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?

Upvotes: 1

Views: 192

Answers (1)

n.x.
n.x.

Reputation: 31

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).

Upvotes: 2

Related Questions