[logo] Tcl-Cpp Details



[intro] [example] [reference] [details]

This page contains a variety of details about the Tcl-Cpp package that have not already been covered.


1. Building and using shared libraries

The Makefile in the current distribution is configured to build a loadable shared library for Tcl7.5+ uder Solaris 2.5. You can even install this under Tcl's package system; however, at present the "package require" commands do not actually load the package - rather, they prepare the interpreter to load a package when one of its commands is attempted to be executed. Since the Tcl-Cpp package must be loaded before any other libraries that depend on it are used, I have a little script (in my .tclshrc):


proc otcl_init {} {
    # What you need to do to initialize Otcl (before loading Otcl extensions)
    if {[info commands otcl] == ""} {
	package require Otcl
	# Trick it into being loaded
	otcl list
    }
    # Then after EACH MODULE you load, you must "otcl clear" 
    # to rebuild the cmd table
    otcl clear
}

If you build further shared libraries that include Tcl-Cpp encapsulations of C++ libraries, you can include something like


    /* Ensure that Otcl is re-kicked to recognize the new cmds */
    return Tcl_Eval(interp, "otcl clear");
in their <Package>_Init functions to ensure that the Tcl-Cpp symbol table is successfully rebuilt.

2. What Tcl-Cpp actually does

The cdl preprocessor converts the *.cdl description file into C++ source and header files; these files define a couple of classes for each wrapped C++ class, and make calls to functions in the base Tcl-Cpp library to define the new Tcl commands (to instance the new class) and to handle the object commands wrapped around any new instance of an object that pass by.

[more details to be added]

Go back to the introduction page.


DAn Ellis <dpwe@icsi.berkeley.edu>
International Computer Science Institute, Berkeley CA 94133
$Header: /n/crab/da/dpwe/public_html/tclcpp/RCS/tclcppdet.html,v 1.1 1997/02/22 02:33:22 dpwe Exp $