Programming Utilities Guide

Linking With libtnfprobe

Linking with the library increases the size of your program by about 33 kilobytes (25 kilobytes shareable) and by the size of the trace file that is allocated (controllable through a command line option to prex). If you are never going to attach to a running program using prex, don't link with libtnfprobe.

However, if a program is not easy to restart and is a long-running program that you might someday want to gather information about, then do link with libtnfprobe. A window server is a good example of this--not the sort of program you want to stop and restart often--so you probably want to link with libtnfprobe before you start it running.

You can link with libtnfprobe in one of two ways:

If you are compiling your program, include -ltnfprobe on the cc line (if using -lthread, always put -ltnfprobe before -lthread).

$ cc -ltnfprobe -lthread -o cookie cookie.c

If your program is already compiled or you don't want to build your program with an explicit dependency on libtnfprobe, use the following command:

$ LD_PRELOAD=libtnfprobe.so.1 executable_object_name

See the Linker and Libraries Guide for an explanation of LD_PRELOAD.