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:
- 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 - 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 - Archive the shared object into a library with the ar command. For example:
ar -q libfasttan.a fasttan.o - 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
tanfunction) 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
sincosfunction is automatically linked if you export MASScosisin. - The MASS
cosfunction is automatically linked if you export MASSsin. - The MASS
atan2is automatically linked if you export MASSatan.
Related external information
- ar and ld in the AIX® Commands Reference, Volumes 1 - 6