If you want 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:
- Use the 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
- Archive the extracted object files into another library:
ar -qv libfasttan.a tan.s32.o
ranlib libfasttan.a
- Create the final executable using xlc,
specifying -lfasttan instead of -lmass:
xlc sample.c -o sample -Ldir_containing_libfasttan -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.
Exceptions: - The sin and cos functions are
both contained in the object files sincos.s32.o and sincos.s64.o. The cosisin and sincos functions
are both contained in the object file cosisin.s32.o.
- The XL C/C++ pow function is
contained in the object files dxy.s32.o and dxy.s64.o.
Note: The cos and sin functions
will both be exported if either one is exported. cosisin and sincos will
both be exported if either one is exported.