.SS History
These functions are part of the dlopen API, derived from SunOS.
.SH EXAMPLE
-Load the math library, and print the cosine of 2.0:
+Load the (glibc) math library, and print the cosine of 2.0:
.nf
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
-
+#include <gnu/lib-names.h> /* Defines LIBM_SO (which will be a
+ string such as "libm.so.6") */
int
main(int argc, char **argv)
{
double (*cosine)(double);
char *error;
- handle = dlopen("libm.so", RTLD_LAZY);
+ handle = dlopen(LIBM_SO, RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\en", dlerror());
exit(EXIT_FAILURE);