Library usage - FoxelSA/libgnomonic GitHub Wiki

Overview

This page is dedicated to library usage that is linkded with compilation options. This page contains a generic documentation that apply for several FOXEL developments.

Compilation options

By default, library compilation trigger static library building. Shared library can be built by editing the following line in the Version file :

STATIC=[true|false]

setting the static flag to false. In both cases, the installation copies the library header files in the following directory :

/usr/include/example/X.Y.Z

where X, Y and Z are the major, minor and revision increments, revision increment being omitted when zero. The library itself is installed in :

/usr/lib/libexample.[a|so].X.Y.Z

Soft link edition is left to end user according to its necessities.

Library usage

After library installation, its usage involves library main header inclusion in client modules :

# include <example-all.[h|hpp]>

depending on C or C++ library. The compilation of a C library client code is made as follows :

gcc -o client client.c -l:libexample.[a|so].X.Y.Z

This way of linking the library is due to the soname of the built shared library that is identical to the installation name. In order to use standard linkage specification :

gcc -o client client.c -lexample

the following soft link has to be created :

ln -sf /usr/lib/libexample.[a|so].X.Y.Z /usr/lib/libexample.[a|so]

Those practices of library versioning can differ from a distribution to another.