Compile, Link and Run

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

Assume you have the files usrCover.c and usrGrav.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 usrCover.c,usrGrav.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 solver may be invoked as
acuSolve -libs ./libusr.so
or through the use of AcuRun as
acuRun -libs ./libusr.so
Multiple user-defined functions may be provided by one or more libraries. To run the solver with multiple libraries, give a comma separated list of libraries to the configuration option -libs. For example, given the libraries libgrav1.so and libgrav2.so stored in directory ~/acusim_libs, the solver may be invoked as
acuRun -libs ~/acusim_libs/libgrav1.so,~/acusim_libs/libgrav2.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 the solver with the option -verbose 2.

Note that 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.

Also note that on most platforms the shared library has a .so extension, but on some it may be .sl (such as HP) or .dll (Windows).