In order for AcuTrace to access the user-defined functions, the functions must be compiled and linked into a shared library. The script acuMakeLib may be used for this purpose.

Assume you have the files "usrEner.c" and "usrEnerF.f" containing the C and Fortran functions given in the previous section. To compile and link into the shared library libusr.so simply issue the command:
acuMakeLib -src usrEner.c,usrEnerF.f

This script writes the makefile, Makefile, and invokes make to compile and link the routines. The makefile has two targets, make all, or equivalently make install, and make clean.

Once the file is successfully compiled and linked, the particle tracer may be invoked as
acuRunTrace -libs ./libusr.so
Multiple user-defined functions may be provided by one or more libraries. To run the particle tracer with multiple libraries, give a comma separated list of libraries to the configuration option -libs. For example, given the libraries libener1.so and libener2.so stored in directory ~/acusim_libs, the particle tracer may be invoked as
acuRunTrace -libs ~/acusim_libs/libener1.so,~/acusim_libs/libener2.so

The libraries are searched sequentially in the order given for the user functions. Libraries that do not exist are ignored. To see what libraries and what routines are accessed by the solver, invoke acuRunTrace with the option -verbose 2.

Note: For most computer platforms, the functions within a given user shared library can access all functions in that library, plus all system and solver functions. However, they may not access functions in other user shared libraries. This behavior is a platform dependent.
Note: On most platforms the shared library has a .so extension, however on some it may be .sl, such as HP, or .dll, Intel/WIN.