mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
26 lines
398 B
C
26 lines
398 B
C
|
#include <dlfcn.h>
|
||
|
#include <stdio.h>
|
||
|
|
||
|
|
||
|
void
|
||
|
__attribute__ ((__constructor__))
|
||
|
constr (void)
|
||
|
{
|
||
|
void *handle;
|
||
|
void *m;
|
||
|
|
||
|
/* Open the library. */
|
||
|
handle = dlopen (NULL, RTLD_NOW);
|
||
|
if (handle == NULL)
|
||
|
{
|
||
|
puts ("Cannot get handle to own object");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
/* Get a symbol. */
|
||
|
m = dlsym (handle, "main");
|
||
|
puts ("called dlsym() to get main");
|
||
|
|
||
|
dlclose (handle);
|
||
|
}
|