RMOL Logo Get Revenue Management Optimisation Library at SourceForge.net. Fast, secure and Free Open Source software downloads

Linking with RMOL

Table of Contents

Introduction

Since version 0.2.0, there are two convenient methods of linking your programs with the RMOL library. The first one employs the `pkg-config' command (see http://pkgconfig.freedesktop.org/), wheres the second one uses `rmol-config' script. These methods are shortly described below.

Using the pkg-config command

`pkg-config' is a helper tool used when compiling applications and libraries. It helps you insert the correct compiler and linker options. The syntax of the `pkg-config' is as follows:

% pkg-config <options> <library_name>  

For instance, assuming that you need to compile an RMOL based program `my_prog.cpp', you should use the following command:

% g++ `pkg-config --cflags rmol` -o my_prog my_prog.cpp `pkg-config --libs rmol`

For more information see the `pkg-config' man pages.

Using the rmol-config script

RMOL provides a shell script called `rmol-config`, which is installed by default in `$prefix/bin' (`/usr/local/bin') directory. It can be used to simplify compilation and linking of RMOL based programs. The usage of this script is quite similar to the usage of the `pkg-config' command.

Assuming that you need to compile the program `my_prog.cpp' you can now do that with the following command:

% g++ `rmol-config --cflags` -o my_prog my_prog.cpp `rmol-config --libs`

A list of `rmol-config' options can be obtained by typing:

% rmol-config --help

If the `rmol-config' command is not found by your shell, you should add its location `$prefix/bin' to the PATH environment variable, e.g.:

% export PATH=/usr/local/bin:$PATH

Using RMOL with dynamic linking

When using static linking some of the library routines in RMOL are copied into your executable program. This can lead to unnecessary large executables. To avoid having too large executable files you may use dynamic linking instead. Dynamic linking means that the actual linking is performed when the program is executed. This requires that the system is able to locate the shared RMOL library file during your program execution. If you install the RMOL library using a non-standard prefix, the `LD_LIBRARY_PATH' environment variable might be used to inform the linker of the dynamic library location, e.g.:

export LD_LIBRARY_PATH=<RMOL installation prefix>/lib:$LD_LIBRARY_PATH
SourceForge Logo

Generated on Wed Feb 9 2011 17:09:18 for RMOL by Doxygen 1.7.1