---
name: "tcl2c++"
section: "1"
platform: "linux"
package: "tclcl"
version: "1.20-13"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/tcl2c++"
---

# tcl2c++(1)

converts tcl scripts into a C++ static character array

## NAME

tcl2c++ - converts tcl scripts into a C++ static character array

## SYNOPSIS

**tcl2c++ name \[file ...\]**

## DESCRIPTION

**tcl2c++** convert the script into an EmbeddedTcl object.

The lines below expand ns-lib.tcl and create the EmbeddedTcl object  instance called et\_ns\_lib:

	tclsh bin/tcl-expand.tcl tcl/lib/ns-lib.tcl \|   \\                   \
                 ../Tcl/tcl2c++ et\_ns\_lib \> gen/ns\_tcl.cc

The script, ~ns/bin/tcl-expand.tcl expands ns-lib.tcl by replacing all source lines with the corresponding source files.

The program, ~tclcl/tcl2cc.c, converts the OTcl code into an equivalent EmbeddedTcl object, et\_ns\_lib.

During initialization, invoking the method EmbeddedTcl::load explicitly  evaluates the array.\
   — ~tclcl/tcl-object.tcl is evaluated by the method Tcl::init(void); \
     Tcl\_AppInit() invokes Tcl::Init(). The exact command syntax for the\
     load is:\
            et\_tclobject.load();

  — Similarly, ~ns/tcl/lib/ns-lib.tcl is evaluated directly by \
     Tcl\_AppInit in ~ns/ns\_tclsh.cc.\
            et\_ns\_lib.load();

## AUTHOR

YunQiang Su \<wzssyqa@gmail.com\>

## SEE ALSO
