1#include <dlfcn.h>
2#include <stdio.h>
3#include <unistd.h>
4
5static void *h;
6
7static void __attribute__((constructor))
8mod2init (void)
9{
10 h = dlopen (file: "unload6mod3.so", RTLD_LAZY);
11 if (h == NULL)
12 {
13 puts (s: "dlopen unload6mod3.so failed");
14 fflush (stdout);
15 _exit (status: 1);
16 }
17}
18
19static void __attribute__((destructor))
20mod2fini (void)
21{
22 dlclose (handle: h);
23}
24

source code of glibc/elf/unload6mod2.c