aboutsummaryrefslogtreecommitdiff
blob: 5ca83d21bc4da0c5b58c91238f7b342b71dac827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <dlfcn.h>
#include <stdio.h>

int
main (void)
{
  void *h = dlopen ("firstobj.so", RTLD_LAZY);
  void *f;
  if (! h)
    {
      printf ("cannot find firstobj.so: %s\n", dlerror ());
      return 1;
    }
  f = dlsym (h, "foo");
  if (! f)
    {
      printf ("cannot find symbol foo: %s\n", dlerror ());
      return 2;
    }
  ((void (*) (void)) f) ();
  return 0;
}