(root)/
glibc-2.38/
elf/
unload6.c
       1  #include <dlfcn.h>
       2  #include <stdio.h>
       3  
       4  int
       5  main (void)
       6  {
       7    void *h = dlopen ("unload6mod1.so", RTLD_LAZY);
       8    if (h == NULL)
       9      {
      10        puts ("dlopen unload6mod1.so failed");
      11        return 1;
      12      }
      13  
      14    int (*fn) (int);
      15    fn = dlsym (h, "foo");
      16    if (fn == NULL)
      17      {
      18        puts ("dlsym failed");
      19        return 1;
      20      }
      21  
      22    int val = fn (16);
      23    if (val != 24)
      24      {
      25        printf ("foo returned %d != 24\n", val);
      26        return 1;
      27      }
      28  
      29    return 0;
      30  }