next up previous contents index
Next: tclvar Up: tcl++ Previous: Global Variables   Contents   Index

Creating a Tcl command

To register a procedure, use the NEWCMD macro. It takes two arguments, the first is the name of the Tcl command to be created, the second is the number of arguments that the Tcl command takes.

Here is an example.

#include "tcl++.h"

NEWCMD(silly_cmd,1)
{printf("argv[1]=%s\n", argv[1]);}
This creates a Tcl command that prints out its argument.



Russell Standish 2016-09-02