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

static void *h;

static void __attribute__((constructor))
mod2init (void)
{
  h = dlopen ("unload6mod3.so", RTLD_LAZY);
  if (h == NULL)
    {
      puts ("dlopen unload6mod3.so failed");
      fflush (stdout);
      _exit (1);
    }
}

static void __attribute__((destructor))
mod2fini (void)
{
  dlclose (h);
}