3.2. Directly loading libpgtcl

This is normally done with the Tcl load command. Here is an example:

load libpgtcl[info sharedlibextension]

The use of info sharedlibextension is recommended in preference to using a platform-dependent extension such as .so, .sl, or .dll.

The load command will fail unless the system's dynamic loader knows where to look for the libpgtcl shared library file. You may need to work with ldconfig, or set the environment variable LD_LIBRARY_PATH, or use some equivalent facility for your platform to make it work. Of course, you can also specify a full path to the library in the load command.

libpgtcl in turn depends on libpq, so the dynamic loader must also be able to find the libpq shared library. Since you cannot directly specify the location of libpq, it must be locatable by whatever rules are used to locate loadable libraries by default. On many platforms, this means using ldconfig or the LD_LIBRARY_PATH environment variable. On Windows systems, it means libpq must be in the PATH or in the same directory as the executable program for the Tcl interpreter.