Compiling and linking a program with MASS

To compile an application that calls the functions in the MASS libraries, specify mass and massvp4 (or massvp5) (32-bit), or mass_64 and massvp4_64 (or massvp5_64) (64-bit) on the -l linker option. For example, if the MASS libraries are installed in the default directory, you could specify one of the following:

xlc progc.c -o progc -lmass -lmassvp4
xlc progc.c -o progc -lmass_64 -lmassvp4_64 -q64

The MASS functions must run in the round-to-nearest rounding mode and with floating-point exception trapping disabled. (These are the default compilation settings.)

Using libmass.a with libm.a

If you wish to use the libmass.a (or libmass_64.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. Use the Linux ar command to extract the object files of the desired functions from libmass.a or libmass_64.a. For most functions, the object file name is the function name followed by .s32.o (for 32-bit mode) or .s64.o (for 64-bit mode).1 For example, to extract the object file for the tan function in 32-bit mode, the command would be:
    ar -x tan.s32.o libmass.a
  2. Archive the extracted object files into another library:
     ar -qv libfasttan.a tan.s32.o 
     ranlib libfasttan.a 
  3. Create the final executable using xlc, specifying -lfasttan instead of -lmass:
    xlc sample.c -o sample dir_containing_libfasttan.a -lfasttan
    This links only the tan function from MASS (now in libfasttan.a) and the remainder of the math functions from the standard system library.
Notes:
  1. The exceptions are:
  2. The MASS cos and sin functions are automatically linked if you export either one of them.