But before we begin talking about how to compile ET applications,
we need to first mention how to compile ET itself --
the et2c preprocessor and the
The source code to the et2c preprocessor is contained in a single file named et2c.c. The preprocessor is written in highly portable K&R C and should compile without change on just about any 32-bit architecture. All you have to do is this:
cc -O -o et2c et2c.c
Compiling the
Let's suppose, for the sake of discussion, that you selected the
source file
Recall that the stardard Tcl/Tk interpreter program, wish, reads and executes a series of Tcl/Tk scripts when it first starts up. These scripts set up default widget bindings, create procedures for handling menus, and so forth. The names of the directories from which these scripts are loaded are hard-coded in the wish executable. There are about 15 different startup scripts (the number varies from one version of Tcl/Tk to the next) and wish will not run without them.
But ET applications don't read the startup scripts at run-time.
Instead, a series of ET_INCLUDE()
statements inside
the Et_Init()
function bind the startup scripts into
an ET executable at compile-time.
This feature is what enables ET applications to run on machines that
do not have Tcl/Tk installed.
It is because of 15 or so startup scripts included by
ET_INCLUDE()
statements in the
ET library that we have to preprocess the library source code
using et2c.
But we also have to tell et2c what directories to use
when searching for the startup scripts.
If Tcl/Tk has already been installed on your system, then you
can find out the names of the startup script directories by executing the
following wish script:
#! wish puts $tk_library puts $tcl_libraryLet's suppose that the startup scripts are located in the directories
et2c -I/usr/local/lib/tcl -I/usr/local/lib/tk et41.c >et.c
After preprocessing the library source code, all that remains
is to compile it.
The library references the <tk.h>
header file,
which in turn references <tcl.h>
, so you
may have to add some -I options to the compiler command
line to specify the directories where these header files are located.
The following is typical:
cc -c -o et.o -I/usr/include/tcl -I/usr/include/tk et.c