Updated 2006-11-11 15:04:52 by lwv

Purpose: Collect community knowledge on commonly encountered problems (and their solutions!) relating to the linkage step of building a compiled application which uses Tcl.

[There are several comp.lang.tcl threads that deal with these issues. Perhaps someone with a passion for the topic will do some research and insert either URLs or text appropriate for this page. One of them in particular goes into excruciating detail ;) about the steps in resolving references.]

The first thing to remember is that when creating a compiled application is that one is going to resolve symbols at compile time if using static libraries and at run time if using dynamic libraries (.dll or .so files typically).

In either case, C and C++ libraries are used to resolve symbols in a first come, first served manner.

Thus, you need to put building block libaries in order of more complex to less complex.

For instance, to link an application that needs BLT, Tk, Tcl, and some OS libraries, you will likely need flags like:
  cc file.c -L/path/to/libraries -lBLT2.4 -ltk8.4 -ltcl8.4 -lm -lc -o executable

On Linux, Solaris, and a few other systems, you probably will even need:
  cc file.c -L/path/to/libraries -R/runtimepath/to/libraries -lBLT2.4 -ltk8.4 -ltcl8.4 -lm -lc -o executable

On windows, using VC++ compiler, to link tcl/tk libraries, you need flags like
  cl /nologo /GX tcl.cpp /link /DEFAULTLIB:tcl84.lib tk84.lib

you have to put the /link option at the end of the command

tclDummyMathPtr

Category Porting