Skip to content
Permalink
9114625bad
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
25 lines (20 sloc) 444 Bytes
#include <dlfcn.h>
#include <stdio.h>
extern void constr (void) __attribute__ ((__constructor__));
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. */
dlsym (handle, "main");
puts ("called dlsym() to get main");
dlclose (handle);
}