Rogue Wave Component Builder (RCB): Building Your Applications : PART I General Build Information : Chapter 2 Additional Topics : Working With Dynamic Binding
Working With Dynamic Binding
When you build an application that uses dynamic binding, generally called a DLL on Windows and a shared library on UNIX, there are two main requirements:
For the build you must link to the required libraries, unless you plan to explicitly load the required libraries at run time.
To run the resulting application, the system must know the location of the dynamic libraries your application depends on.
Linking to Required Libraries
On Windows, dynamic builds result in two distinct objects: the import library and the DLL. For the Essential Tools Module library built in the 12d configuration, these would be:
Link library: tls12d.lib
DLL: tls<ver>12d.dll
To build your application, you link to the .lib version. To run your application, you use the .dll version as described in the next section.
On UNIX systems, there is no such division. The library build results in a single object with the shared object extension specific to the platform (libtls<ver>12d.so for the above case on Solaris). You both link to this object when building your application and use the object to run your application.
Running the Application
Before you can run your application, the operating system must be able to find the required dynamic libraries required by the application.
Windows requirements
To run your application on Windows, the Windows system must be able to find the .dll version of the SourcePro C++ libraries you linked to when building the application, and the DLL version of the Microsoft runtime library.
The system looks for DLLs in the following locations in the order listed:
the directory containing the application executable
the current directory
the windows system directory
the directories listed in the PATH environment variable
You shouldn’t need to worry about the Microsoft runtime library, but you should put a copy of the SourcePro C++ DLLs in one of the above locations, or modify the PATH environment variable to include their location. Generally, you can access and edit the PATH from Control Panel | System | Advanced | Environment Variables, depending on the version of your operating system.
UNIX requirements
On UNIX, there is an environment variable that your operating system uses to describe the possible locations of shared libraries. Before you try to run your shared application, be sure the location of the libraries you used to create the application is specified in this environment variable.
For many operating systems, the environment variable for shared libraries is LD_LIBRARY_PATH. Some operating systems use a different name, so be sure to use the name appropriate to your operating system.
You may set the library path variable from your shell, or by including it in your rc or profile script.
In a Korn, Bourne or similar shell, if your libraries are installed in the /usr/local/rwav/lib directory, use the following command:
 
export LD_LIBRARY_PATH=/usr/local/rwav/lib:$LD_LIBRARY_PATH
If you use the C shell or a similar shell, the command is:
 
setenv LD_LIBRARY_PATH /usr/local/rwav/lib:$LD_LIBRARY_PATH