[英]Missing built-in command “history” for Tcl C extension
I am working on a project need Tclsh like support with some self-defined commands. 我正在一个需要像一些自定义命令支持的Tclsh项目。 I implemented following code (based on Tcl 8.5):
我实现了以下代码(基于Tcl 8.5):
Tcl_Main(argc, argv, Tcl_AppInit);
And put new commands registration in Tcl_AppInit. 并将新命令注册放入Tcl_AppInit。 Everything looks fine, except that with the new command line interpreter, when I type Tcl built-in command "history", I got :
一切看起来都很好,除了使用新的命令行解释器外,当我键入Tcl内置命令“ history”时,我得到:
% history
invalid command name "history"
Other built-in commands work fine, like "puts", "set", etc. Why ? 其他内置命令也可以正常工作,例如“ puts”,“ set”等。为什么? Do I have to implement my own "history" command instead?
我是否必须实现自己的“历史”命令?
在这里添加我的解决方案:事实证明, history
是Tcl脚本库的一部分,需要在初始化期间通过提供$TCL_LIBRARY/init.tcl
或调用Tcl_Init(interp)
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.