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:
459 bytes
|
Line | |
---|
1 | #include <dlfcn.h>
|
---|
2 | #include <stdio.h>
|
---|
3 |
|
---|
4 |
|
---|
5 | extern void constr (void) __attribute__ ((__constructor__));
|
---|
6 | void
|
---|
7 | __attribute__ ((__constructor__))
|
---|
8 | constr (void)
|
---|
9 | {
|
---|
10 | void *handle;
|
---|
11 | void *m;
|
---|
12 |
|
---|
13 | /* Open the library. */
|
---|
14 | handle = dlopen (NULL, RTLD_NOW);
|
---|
15 | if (handle == NULL)
|
---|
16 | {
|
---|
17 | puts ("Cannot get handle to own object");
|
---|
18 | return;
|
---|
19 | }
|
---|
20 |
|
---|
21 | /* Get a symbol. */
|
---|
22 | m = dlsym (handle, "main");
|
---|
23 | puts ("called dlsym() to get main");
|
---|
24 |
|
---|
25 | dlclose (handle);
|
---|
26 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.