Getting Started¶
Compiling and installing libdynamic¶
The libdynamic source is available at https://github.com/fredrikwidlund/libdynamic/releases/download/v1.0.0/libdynamic-1.0.0.tar.gz
Unpack the source tarball and change to the source directory:
$ tar xfz libdynamic-1.0.0.tar.gz $ cd libdynamic-1.0.0
The source uses GNU Autotools (autoconf, automake, libtool), so compiling and installing is extremely simple:
$ ./configure
$ make
$ make install
To run the test suite which requires cmocka and valgrind, invoke:
$ make check
To change the destination directory (/usr/local
by default), use
the --prefix=DIR
argument to ./configure
. See ./configure
--help
for the list of all possible configuration options.
The command make check
runs the test suite distributed with
libdynamic. This step is not strictly necessary, but it may find possible
problems that libdynamic has on your platform. If any problems are found,
please report them.
If you obtained the source from a Git repository (or any other source
control system), there’s no ./configure
script as it’s not kept in
version control. To create the script, the build system needs to be
bootstrapped. There are many ways to do this, but the easiest one is
to use the supplied autogen.sh script:
$ ./autogen.sh
Building the documentation¶
(This subsection describes how to build the HTML documentation you are currently reading, so it can be safely skipped.)
Documentation is in the docs/
subdirectory. It’s written in
reStructuredText with Sphinx annotations. To generate the HTML
documentation, invoke:
$ make html
and point your browser to doc/_build/html/index.html
. Sphinx 1.0
or newer is required to generate the documentation.
Compiling programs that use libdynamic¶
libdynamic headers files are included through one C header file, dynamic.h
, so it’s enough
to put the line
#include <dynamic.h>
in the beginning of every source file that uses libdynamic.
There’s also just one library to link with, libdynamic
. libdynamic is built as a static library
and should be compiled with LTO (link time optimization) to provide the best performance. Compile and
link the program as follows:
$ cc -o prog prog.c -flto -fuse-linker-plugin -ldynamic
Use of pkg-config is supported and recommended:
$ cc -o prog prog.c `pkg-config --cflags --libs libdynamic`