summary refs log tree commit diff
path: root/dlfcn/failtestmod.c
blob: 595da4d567834c8e1ab90be9326d42d1181bf9b6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <dlfcn.h>
#include <stdio.h>


void
__attribute__ ((__constructor__))
constr (void)
{
  void *handle;
  void *m;

  /* Open the library.  */
  handle = dlopen (NULL, RTLD_NOW);
  if (handle == NULL)
    {
      puts ("Cannot get handle to own object");
      return;
    }

  /* Get a symbol.  */
  m = dlsym (handle, "main");
  puts ("called dlsym() to get main");

  dlclose (handle);
}