A shared library provides a mechanism that allows a single copy of code to be shared by several instances of programs in a system. Programs can be written to load dynamic libraries without any prior arrangement at link time. Shared libraries are loaded dynamically while the program is running.
One of the major advantages of using dynamic libraries is the possibility to provide new, specialized, or enhanced functionality by developing components that can be loaded at runtime, under program control.
Note: To instruct the server to load the callback library, the SQL_OPTION LOAD_CALLBACK_LIB FairCom Server configuration keyword must be specified.
Windows Environment
Under Windows, the FairCom DB SQL callback dynamic library is called ctsqlcbk.dll, and is created as a Windows DLL.
When loading a DLL under Windows, the system looks through a series of directories, as follows:
We recommend the FairCom DB SQL callback DLL be located in the FairCom DB SQL operating directory.
Unix Environment
Under Unix based systems, the FairCom DB SQL callback dynamic library is called libctsqlcbk, with a file extension appropriate for that operating system's shared library conventions (.so, .sl, .dynlib, etc.) and it is created as a Unix shared library.
Unix shared libraries must be located and loaded by the system on demand. In order for shared libraries to be loaded at runtime, the Unix dynamic loader must know where to locate it at run time.
Unix systems use environment variables to select custom library directories. Among the different Unix platforms, there are three search path variables in use.
The table below lists these variables and the platforms that use them.
Environment Variable |
Unix Platforms |
---|---|
LD_LIBRARY_PATH |
Solaris, UnixWare, Linux |
LIBPATH |
AIX |
SHLIB_PATH |
HP-UX |
We recommend that the FairCom DB SQL callback shared library be located in the FairCom DB SQL operating directory. For example, if the FairCom DB SQL directory is /home/ctreeSQL, the LD_LIBRARY_PATH environment variable could be:
$ LD_LIBRARY_PATH = /home/ctreeSQL
$ export LD_LIBRARY_PATH
If the LD_LIBRARY_PATH environment variable is already set, it may be necessary to append the FairCom DB SQL operating directory at the end of the path as shown here:
$ LD_LIBRARY_PATH = $LD_LIBRARY_PATH:/home/ctreeSQL
$ export LD_LIBRARY_PATH