Last change
on this file was 2036, checked in by bird, 20 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
900 bytes
|
Line | |
---|
1 | #include <dlfcn.h>
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <stdlib.h>
|
---|
4 |
|
---|
5 | #include <tls.h>
|
---|
6 |
|
---|
7 |
|
---|
8 | #define TEST_FUNCTION do_test ()
|
---|
9 | static int
|
---|
10 | do_test (void)
|
---|
11 | {
|
---|
12 | #ifdef USE_TLS
|
---|
13 | static const char modname[] = "tst-tlsmod2.so";
|
---|
14 | int result = 0;
|
---|
15 | int *foop;
|
---|
16 | int (*fp) (int, int *);
|
---|
17 | void *h;
|
---|
18 |
|
---|
19 | h = dlopen (modname, RTLD_LAZY);
|
---|
20 | if (h == NULL)
|
---|
21 | {
|
---|
22 | printf ("cannot open '%s': %s\n", modname, dlerror ());
|
---|
23 | exit (1);
|
---|
24 | }
|
---|
25 |
|
---|
26 | fp = dlsym (h, "in_dso");
|
---|
27 | if (fp == NULL)
|
---|
28 | {
|
---|
29 | printf ("cannot get symbol 'in_dso': %s\n", dlerror ());
|
---|
30 | exit (1);
|
---|
31 | }
|
---|
32 |
|
---|
33 | result |= fp (0, NULL);
|
---|
34 |
|
---|
35 | foop = dlsym (h, "foo");
|
---|
36 | if (foop == NULL)
|
---|
37 | {
|
---|
38 | printf ("cannot get symbol 'foo' the second time: %s\n", dlerror ());
|
---|
39 | exit (1);
|
---|
40 | }
|
---|
41 | if (*foop != 16)
|
---|
42 | {
|
---|
43 | puts ("foo != 16");
|
---|
44 | result = 1;
|
---|
45 | }
|
---|
46 |
|
---|
47 | dlclose (h);
|
---|
48 |
|
---|
49 | return result;
|
---|
50 | #else
|
---|
51 | return 0;
|
---|
52 | #endif
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | #include "../test-skeleton.c"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.