Using libmass.a with the math system library

This section explains how to use the libmass.a scalar library for some functions and the normal math library libm.a for other functions.

Follow this procedure to compile and link your program:
  1. Create an export list that is a flat text file and contains the names of the wanted functions. For example, to select only the fast tangent function from libmass.a for use with the C program sample.c, create a file called fasttan.exp with the following line:
    tan
  2. Create a shared object from the export list with the ld command, linking with the libmass.a library. For example:
    ld -bexport:fasttan.exp -o fasttan.o -bnoentry -lmass -bmodtype:SRE
  3. Archive the shared object into a library with the ar command. For example:
    ar -q libfasttan.a fasttan.o
  4. Create the final executable using IBM® Open XL C/C++, specifying the object file containing the MASS functions. This links only the functions specified in the object file (in this example, the tan function) and the remainder of the math functions from the standard math library. For example:
    ibm-clang sample.c -o sample -Ldir_containing_libfasttan -lfasttan 
Notes:
  • The MASS sincos function is automatically linked if you export MASS cosisin.
  • The MASS cos function is automatically linked if you export MASS sin.
  • The MASS atan2 is automatically linked if you export MASS atan.
Related external information