Using C code in Tcl has never been easier ========================================= 2001/11/19: Support app-specific initialization 2001/11/18: Added static lib output 2001/11/15: Initial release CritBind is a utility script which works in combination with "CriTcl" to automatically generate object code from C, nicely wrapped for use in Tcl. Usage: critbind ?-link lib? outfile infiles... The input files must all be Tcl scripts with calls to CriTcl in them. These are source'd and compilation is forced, producing object code which is then combined into a single file. The default is to create a "merged extension library", but if "-link" is specified, an executable will be built instead. The "lib" arg specifies the Tcl library to link to. If a static (.a) lib is given, the executable will be fully self-contained, otherwise it will use shared libraries (and be much smaller). Note that as library all extensions are inited by the load command, whereas with executables you'll need to do "load {} blah" to enable package "blah". This may change in the future. Examples: Combine all of critlib's packages into a single "critlib.so": critbind critlib.so $path/critlib/*.tcl Combine all of critlib's packages into a "critlib.a" to link later: critbind critlib.a $path/critlib/*.tcl Build a tiny "critclsh" app with all compiled CritLib code in it: critbind -link $path/libtcl8.4.so critclsh $path/critlib/*.tcl Build a big statically-linked app, which also includes Tcl itself: critbind -link $path/libtcl8.4.a critclsh $path/critlib/*.tcl Note that this binding deals only with the (compiled) C side of things. The package scripts / supporting Tcl code are not in the file generated by critbind. That, dear reader, will happen later... For now, you can simply "load" the code, and then use the packages as before - CriTcl compilation does not happen if commands exist, i.e. this binding mechanism is good enough to *not* require a compiler everywhere. This initial release does not know about Tk (or wish). Nevertheless, it should be possible to load and use Tk: the latest versions of Tcl support loading Tk dynamically, i.e. as a normal extension.