|
Packit |
6c4009 |
#include <dlfcn.h>
|
|
Packit |
6c4009 |
#include <errno.h>
|
|
Packit |
6c4009 |
#include <error.h>
|
|
Packit |
6c4009 |
#include <mcheck.h>
|
|
Packit |
6c4009 |
#include <stdio.h>
|
|
Packit |
6c4009 |
#include <stdlib.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
int
|
|
Packit |
6c4009 |
main (void)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int (*foo) (void);
|
|
Packit |
6c4009 |
void *h;
|
|
Packit |
6c4009 |
int ret;
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
mtrace ();
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
h = dlopen ("constload2.so", RTLD_LAZY | RTLD_GLOBAL);
|
|
Packit |
6c4009 |
if (h == NULL)
|
|
Packit |
6c4009 |
error (EXIT_FAILURE, errno, "cannot load module \"constload2.so\"");
|
|
Packit |
6c4009 |
foo = dlsym (h, "foo");
|
|
Packit |
6c4009 |
ret = foo ();
|
|
Packit |
6c4009 |
/* Note that the following dlclose() call cannot unload the objects.
|
|
Packit |
6c4009 |
Due to the introduced relocation dependency constload2.so depends
|
|
Packit |
6c4009 |
on constload3.so and the dependencies of constload2.so on constload3.so
|
|
Packit |
6c4009 |
is not visible to ld.so since it's done using dlopen(). */
|
|
Packit |
6c4009 |
if (dlclose (h) != 0)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
puts ("failed to close");
|
|
Packit |
6c4009 |
exit (EXIT_FAILURE);
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
return ret;
|
|
Packit |
6c4009 |
}
|