You can organize your C code into a loadable package that can be dynamically linked into tclsh, wish, or your own Tcl application. The details about compiling the code into the shared library that contains the package are presented in Chapter 45. This section describes a package that implements the random Tcl command that returns random numbers.
The Tcl load command is used to dynamically link in a compiled package:
load library package ?interp?
The library is the file name of the shared library file (i.e., the DLL), and package is the name of the package implemented by the library. This name corresponds to the package_Init procedure called to initialize the package (e.g., Random_Init) The optional ...