I will explain what *I* have done.
I have written some libraries in C++. And then I used SWIG to create a Tcl
binding. There are two ways to use these libraries:
1) Write a C++ program and then link with the library (eg g++ ... -l<mumble>).
2) Write a Tcl (/Tk) prorgam and [load] the library (eg [load lib<mumble>.so],
or [package require <mumble>]).
Normally you would NOT write some *other* Tcl extension and link that against
the lib<mumble>.so file and 99% of Tcl/Tk extensions don't expect to be used
that way. *Some* Tcl/Tk extensions can be used as plain old C/C++ libraries
with plain old C/C++ *programs* (no Tcl/Tk code at all) and those extensions
provide not only the library .so file (and pkgIndex.tcl file), but also header
files. If a binary extension is built with the stubs libraries, it is not
actually linked to Tcl/Tk, it is only linked to a *static* library that only
contains an *empty* jump table. If the "C/C++" API *does not* use the Tcl_/Tk_
API, then the library can be safely used from a pure C/C++ program. When one
(for example) uses SWIG to create the Tcl binding *only* the SWIG interface
code uses the Tcl API (via the stubs libraries). The only public (extern)
function exposed is the <mumble>_Init() function, which should only ever be
called from the Tcl [load] command. This function calls the stubs
initialization function (fills the jump table) and then calls
Tcl_Create..Command() function to define Tcl commands in the Tcl Interpeter
(thus 'creating' the Tcl bindings). SWIG creates the little functions that
Tcl_Create..Command() 'binds' to the Tcl command words -- these little
functions call the C/C++ functions using 'native' C/C++ calls.
It sounds like tkblt is much the same (I wonder if it uses SWIG...).
I belive the Itcl/Itk libraries have stubs, just like Tcl/Tk, and like Tcl/Tk
can be [loaded] or linked or *both* (via stubs libraries). I believe Itcl/Itk
can be used *instead* of Tcl/Tk.
>
> Still wondering...
>
> Best regards
>
> Ole
>