Updated 2010-01-06 20:09:23 by dkf
int Tcl_InitStubs(interp, version, exact)

This function is called by an extension (one of the things hooked into Tcl by load) as the first step of initializing the extension. It's just like a Tcl_PkgRequire of the Tcl library itself (you were doing that already, yes?) but also makes available the rest of the Tcl library functions within the extension. You then compile the extension library with -DUSE_TCL_STUBS set and link against libtclstub.a (which probably has a version number too, and might have a different suffix, e.g., .lib on Windows).

The arguments are:
The interpreter that was an argument to your *_Init function.
The minimum version of Tcl that you want to support. This should also be the version of the static stub library that you link into your extension during compilation.
Whether you want an exact version of Tcl. You probably don't, so set this to 0.

The result is either TCL_OK (in which case you can keep on doing the rest of your initialization) or TCL_ERROR (something went wrong, probably a version mismatch). If you get an error, the only safe thing to do is to immediately return TCL_ERROR from the initialization function; no other Tcl API function may be used.