Next: Tutorial, Previous: How it works, Up: Top
Following are a set of examples that are intended to illustrate what exactly is possible with the mpatrol library and how to go about using it effectively.
You should already have built and installed the library and should know how to link programs with the library. Unfortunately, it isn't possible to give specific instructions on how to do this as it varies from system to system and also depends on your preferred compiler and development tools.
However, on a typical SVR4 UNIX system, with mpatrol installed in /usr/local, the mpatrol library can usually be incorporated into a program using the following commands:
cc -I/usr/local/include <file> -L/usr/local/lib -lmpatrol
cc -I/usr/local/include <file> -L/usr/local/lib -lmpatrol -lld
cc -I/usr/local/include <file> -L/usr/local/lib -lmpatrol -lelf
cc -I/usr/local/include <file> -L/usr/local/lib -lmpatrol -lbfd -liberty -lintl
cc -I/usr/local/include <file> -L/usr/local/lib -lmpatrol -lbfd -liberty -lintl -lunwind
cc -I/usr/local/include <file> -L/usr/local/lib -lmpatrol -lbfd -liberty -lintl -lcl
On Windows platforms, with mpatrol installed in /mpatrol, the mpatrol library can usually be incorporated into a program using the following commands:
cl -I/mpatrol/include -Zi <file> -link -libpath:/mpatrol/lib -defaultlib:libmpatrol -defaultlib:imagehlp -pdb:none
cl -I/mpatrol/include -MD -Zi <file> -link -libpath:/mpatrol/lib -defaultlib:mpatrol -pdb:none
If you need to link with other libraries, make sure that they don't contain
definitions of malloc()
, etc., or if they do then you must ensure that
the mpatrol library appears before them on the link line. Note also that if the
mpatrol library was built on Tru64, or on IRIX with the
MP_LIBRARYSTACK_SUPPORT
preprocessor macro defined, then the
libexc library must be linked in as well. You should also check the
section on supported systems (see Supported systems) to see if there are any
other issues on the platform that you are using.
You should also know how to set an environment variable on your specific system. Again, this varies from system to system and also depends on the command line interpreter or shell that you use. The environment variable that the mpatrol library uses is called MPATROL_OPTIONS. You can see exactly what options are available for this environment variable by setting it to HELP and then running a program that has been linked with the library.