manual: delete nested @cartouche
[glibc.git] / elf / tst-tls4.c
blob4ae33db24d9e633fac73613aef6e24e8e542f3ac
1 #include <dlfcn.h>
2 #include <stdio.h>
3 #include <stdlib.h>
5 #include <tls.h>
8 #define TEST_FUNCTION do_test ()
9 static int
10 do_test (void)
12 static const char modname[] = "tst-tlsmod2.so";
13 int result = 0;
14 int *foop;
15 int (*fp) (int, int *);
16 void *h;
18 h = dlopen (modname, RTLD_LAZY);
19 if (h == NULL)
21 printf ("cannot open '%s': %s\n", modname, dlerror ());
22 exit (1);
25 fp = dlsym (h, "in_dso");
26 if (fp == NULL)
28 printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
29 exit (1);
32 result |= fp (0, NULL);
34 foop = dlsym (h, "foo");
35 if (foop == NULL)
37 printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
38 exit (1);
40 if (*foop != 16)
42 puts ("foo != 16");
43 result = 1;
46 dlclose (h);
48 return result;
52 #include "../test-skeleton.c"