2000-06-10 06:31:24 +02:00
|
|
|
#include <dlfcn.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
2000-11-29 01:04:54 +01:00
|
|
|
extern void constr (void) __attribute__ ((__constructor__));
|
2000-06-10 06:31:24 +02:00
|
|
|
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);
|
|
|
|
}
|