Linking with CPLEX shared libraries on non-Windows platforms
Outlines how to link with CPLEX shared libraries on non-Windows platforms.
As opposed to Windows, where CPLEX only ships a dynamic library, on most of the other platforms CPLEX ships with a static and a dynamic library. All makefiles and examples are set up to link with the static library by default. This is easier for deployment purposes since the library is directly copied into the executable and thus does not need to be deployed separately. Also, no version conflicts can occur since the binary does not even reference a library that could have a version mismatch.
In some situations, however, statically linking with the CPLEX library is not an option. This can occur, for example, if you write a connector for a programming language that CPLEX does not support out of the box.
Using shared libraries is very similar to using static libraries with these two differences:
- In the link step, the binary must be linked with the dynamic, not the static, library.
- At runtime, the dynamic linker must be able to find the dynamic library so that it can load it when loading the binary into memory. This is usually achieved by setting the library search path environment variable so that it contains the directory with the CPLEX dynamic library.