2000-06-10 12:31:24 +08:00
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
2000-11-29 08:04:54 +08:00
|
|
|
extern void constr (void) __attribute__ ((__constructor__));
|
2000-06-10 12:31:24 +08:00
|
|
|
void
|
|
|
|
__attribute__ ((__constructor__))
|
|
|
|
constr (void)
|
|
|
|
{
|
|
|
|
void *handle;
|
|
|
|
|
|
|
|
/* Open the library. */
|
|
|
|
handle = dlopen (NULL, RTLD_NOW);
|
|
|
|
if (handle == NULL)
|
|
|
|
{
|
|
|
|
puts ("Cannot get handle to own object");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get a symbol. */
|
2014-11-28 00:00:08 +08:00
|
|
|
dlsym (handle, "main");
|
2000-06-10 12:31:24 +08:00
|
|
|
puts ("called dlsym() to get main");
|
|
|
|
|
|
|
|
dlclose (handle);
|
|
|
|
}
|