manual: fix a typo in strtoul description [BZ #21161]
[glibc.git] / elf / constload2.c
blobbf1bf182f3a77a8a4dc11a8c66e459d6169f0032
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 extern int bar (void);
6 extern int baz (void);
7 extern int foo (void);
8 extern void __attribute__ ((__constructor__)) init (void);
10 void *h;
12 int
13 foo (void)
15 return 42 + bar ();
18 int
19 baz (void)
21 return -21;
25 void
26 __attribute__ ((__constructor__))
27 init (void)
29 h = dlopen ("constload3.so", RTLD_GLOBAL | RTLD_LAZY);
30 if (h == NULL)
32 puts ("failed to load constload3");
33 exit (1);
35 else
36 puts ("succeeded loading constload3");
39 static void
40 __attribute__ ((__destructor__))
41 fini (void)
43 if (dlclose (h) != 0)
45 puts ("failed to unload constload3");
46 exit (1);
48 else
49 puts ("succeeded unloading constload3");