O'Reilly logo

Practical Programming in Tcl & Tk, Third Edition by Brent B. Welch

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a Loadable Package

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 load Command

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required