SEvMgr Logo  1.00.0
C++ Simulation-Oriented Discrete Event Management Library
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Linking with SEvMgr

Table of Contents

Introdution

There are two convenient methods of linking your programs with the SEvMgr library. The first one employs the `pkg-config' command (see http://pkgconfig.freedesktop.org/), whereas the second one uses `sevmgr-config' script. These methods are shortly described below.

Dependencies

The SEvMgr library depends on several other C++ components.

StdAir

Among them, as for now, only StdAir has been packaged. The support for StdAir is taken in charge by a dedicated M4 macro file (namely, `stdair.m4'), from the configuration script (generated thanks to `configure.ac').

sevmgr_dependencies.png
SEvMgr Dependencies

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 SEvMgr based program `my_prog.cpp', you should use the following command:

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

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

Using the sevmgr-config script

SEvMgr provides a shell script called sevmgr-config, which is installed by default in `$prefix/bin' (`/usr/local/bin') directory. It can be used to simplify compilation and linking of SEvMgr 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++ `sevmgr-config --cflags` -o my_prog_opt my_prog.cpp `sevmgr-config --libs`

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

sevmgr-config --help

If the `sevmgr-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

M4 macro for the GNU Autotools

A M4 macro file is delivered with SEvMgr, namely `sevmgr.m4', which can be found in, e.g., `/usr/share/aclocal'. When used by a `configure' script, thanks to he `AM_PATH_SEvMgr' macro (specified in the M4 macro file), the following Makefile variables are then defined:

  • `SEvMgr_VERSION' (e.g., defined to 0.23.0)
  • `SEvMgr_CFLAGS' (e.g., defined to `-I${prefix}/include')
  • `SEvMgr_LIBS' (e.g., defined to `-L${prefix}/lib -lsevmgr')

Using SEvMgr with dynamic linking

When using static linking some of the library routines in SEvMgr 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 SEvMgr library file during your program execution. If you install the SEvMgr 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=<SEvMgr installation prefix>/lib:$LD_LIBRARY_PATH