View on GitHub

Cpptcl

C++/Tcl, a library that allows to easily integrate C++ and Tcl.

Download this project as a .zip file Download this project as a tar.gz file
[prev][top]

Compiling

The C++/Tcl library consists of the following files:
The C++/Tcl library depends on the Tcl core library and on the Boost library (see http://www.boost.org/). Any recent version of these two should work fine.

Note: The Boost library is used in a way that does not require its installation nor even compilation. It is enough to just download the Boost distribution and unpack it in a place where it will be found by the compiler.

Note: In its current version, the C++/Tcl library is not thread-safe in the sense that it should not be used in the multithreaded environment, where many threads can register new commands or use extended commands in scripts.

Unix, GNU/Linux

On Unix-like systems, the following command is enough to compile a one-file C++/Tcl program (shown for FreeBSD):
$ g++ myprog.cc cpptcl.cc -o myprog -I/usr/local/include/tcl8.4 -I/usr/local/include/boost_1_33_0 -L/usr/local/lib -ltcl84
Similarly, the following compiles a simple loadable shared module:
$ g++ mymodule.cc cpptcl.cc -shared -o myprog -I/usr/local/include/tcl8.4 -I/usr/local/include/boost_1_33_0
Depending on the specific Unix system, it may be necessary to use different search paths.
Note also that a decent g++ compiler is necessary (in particular, g++ 2.95 or 2.96 will not work).

The Makefiles provided with test and example programs should serve as good examples.