|
Last change
on this file since 2442 was 2036, checked in by bird, 21 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:
515 bytes
|
| Line | |
|---|
| 1 | #include <dlfcn.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 |
|
|---|
| 5 | int
|
|---|
| 6 | main (void)
|
|---|
| 7 | {
|
|---|
| 8 | void *handle;
|
|---|
| 9 | int (*test) (int);
|
|---|
| 10 | int res;
|
|---|
| 11 |
|
|---|
| 12 | handle = dlopen ("modstatic.so", RTLD_LAZY);
|
|---|
| 13 | if (handle == NULL)
|
|---|
| 14 | {
|
|---|
| 15 | printf ("%s\n", dlerror ());
|
|---|
| 16 | exit(1);
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | test = dlsym (handle, "test");
|
|---|
| 20 | if (test == NULL)
|
|---|
| 21 | {
|
|---|
| 22 | printf ("%s\n", dlerror ());
|
|---|
| 23 | exit(1);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | res = test (2);
|
|---|
| 27 | if (res != 4)
|
|---|
| 28 | {
|
|---|
| 29 | printf ("Got %i, expected 4\n", res);
|
|---|
| 30 | exit (1);
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | dlclose (handle);
|
|---|
| 34 | return 0;
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.