With this approach, all external files are loaded and initialised together, exactly like with Tcl/Tk alone. If the underlying architecture does not support dynamic loading, this is the only possible way of using the extensions. There are several steps to be performed:
For example, the Tree extension defines Tcl_AppInit in the file tkAppInit.C.
Tree has a main() in the tkAppInit.C file which must be commented out. Furthermore, the Tcl_AppInit function initialises not only Tree but also Itcl and other extensions. If we do not want them, we comment out the calls to Itcl_Init() and other functions and leave only calls to Tree_Init and Dir_Init.
We use the Tree Makefile to produce tkAppInit.o.
Some compilers may also link libraries which are not explicitly mentioned in the Makefile. If such libraries are omitted, the linker will complain about missing symbols. If this is the case, use the verbose flag (e.g. -v) for the compilation of the extended wish so that all libraries and special files are explicitly listed. For example, the gnu C++ compiler needs the library -lg++ and possibly also a -L flag to specify the directory where it resides.
When we add -v to CFLAGS in the Tree Makefile, we obtain (on Linux)ld -dll-verbose -m486 -o tree_wish /usr/lib/crt0.o -L/usr/X11R6/lib \ -L/usr/lib/gcc-lib/i486-linux/2.6.3 tkAppInit.o ./src/libTkTree.a \ /home/micha/lib/libtk4.0.a /home/micha/lib/libtcl7.4.a \ -lX11 -lieee -lg++ -lm -lgcc -lc -lgccThe important files are libTkTree.a, tkAppInit.o and -lg++ (it could also be -lgcc - we can first try it without and if there are some missing symbols, we add it).
The next steps depend on the underlying machine architecture.