(linenum→info "unix/slp.c:2238")

glibc/2.7/elf/constload1.c

    1: #include <dlfcn.h>
    2: #include <errno.h>
    3: #include <error.h>
    4: #include <mcheck.h>
    5: #include <stdio.h>
    6: #include <stdlib.h>
    7: 
    8: int
    9: main (void)
   10: {
   11:   int (*foo) (void);
   12:   void *h;
   13:   int ret;
   14: 
   15:   mtrace ();
   16: 
   17:   h = dlopen ("constload2.so", RTLD_LAZY | RTLD_GLOBAL);
   18:   if (h == NULL)
   19:     error (EXIT_FAILURE, errno, "cannot load module \"constload2.so\"");
   20:   foo = dlsym (h, "foo");
   21:   ret = foo ();
   22:   /* Note that the following dlclose() call cannot unload the objects.
   23:      Due to the introduced relocation dependency constload2.so depends
   24:      on constload3.so and the dependencies of constload2.so on constload3.so
   25:      is not visible to ld.so since it's done using dlopen().  */
   26:   if (dlclose (h) != 0)
   27:     {
   28:       puts ("failed to close");
   29:       exit (EXIT_FAILURE);
   30:     }
   31:   return ret;
   32: }
Syntax (Markdown)