tcl_c++: an Interface Between tcl and c++


c++_tcl architecture.

This software allows a c++ programmer to create a tcl interface to c++ objects with minimal coding overhead (basically one line per member function). The name of the class becomes a tcl procedure (with or without arguments depending on what constructors are defined) that calls the appropriate constructor and creates a tcl procedure to interface to the newly created object. This tcl procedure uses its first argument to decide which member function of the object to call. The value of variables and constants are also available to tcl programs. Multiple inheritance is supported.

To use tcl_c++ you must create a file called myClassTCL.tcl for each c++ class, for example:

startClass  myClass
constructor
constructor int double
memberFunction void member
memberFunction int integer
memberFunction int integerArgument int
memberFunction myClass* pointerArgumentReturn myClass*
memberFunction myClass& referenceArgumentReturn myClass&
memberFunction void twoArguments int char*
memberFunction int* handlePointers double*
memberConstant double  doubleConstant
memberVariable  int  integerVariable
destructorCommand delete
baseClass baseClass1
baseClass baseClass2
endClass

Note: only the parts of the class that should be available to tcl are put in the file.

This file is actually a tcl program. The tcl procedures startClass, constructor, memberFunction and so forth are defined in a file called convert.tcl. Now for the explanations:

Note the following issues:

Known problems:

I had hoped to distribute the code on the WWW, but it's not quite ready for wide distribution -- especially the regression test. If you are interested in using tcl_c++, send email to globus@nas.nasa.gov.

To the NanoDesign paper.


NAS Author: Al Globus