Back to index

glibc  2.9
Functions
bug-dlsym1.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <dlfcn.h>

Go to the source code of this file.

Functions

int main (void)

Function Documentation

int main ( void  )

Definition at line 8 of file bug-dlsym1.c.

{
    void *handle;
    char *c;

    /* open lib1.so, which has the unresolved test symbol and a DT_NEEDED
       on lib2.so, which provides the symbol */
    if ((handle = dlopen("bug-dlsym1-lib1.so", RTLD_NOW)) == NULL) {
       printf("dlopen(\"bug-dlsym1-lib1.so\"): %s\n", dlerror());
       abort();
    }

    if ((c = dlsym(handle, "dlopen_test_variable")) == NULL) {
       printf("dlsym(handle, \"dlopen_test_variable\"): %s\n", dlerror());
       abort();
    }

    (void) dlclose(handle);

    return 0;
}

Here is the call graph for this function: