d743ba1e9b
2000-06-09 H.J. Lu <hjl@gnu.org> * dlfcn/dlerror.c (_dlerror_run): Set result->errstring to NULL after freeing it. * dlfcn/Makefile (distribute): Add failtestmod.c. (tests): Add failtest. Add rules to build and run failtest. * dlfcn/failtest.c: New file. * dlfcn/failtestmod.c: New file.
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);
|
|
}
|