|
Packit Service |
82fcde |
#include <dlfcn.h>
|
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <stdlib.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static int
|
|
Packit Service |
82fcde |
do_test (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
void *handle;
|
|
Packit Service |
82fcde |
int (*test) (int);
|
|
Packit Service |
82fcde |
int res;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
handle = dlopen ("modstatic.so", RTLD_LAZY);
|
|
Packit Service |
82fcde |
if (handle == NULL)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("%s\n", dlerror ());
|
|
Packit Service |
82fcde |
exit(1);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
test = dlsym (handle, "test");
|
|
Packit Service |
82fcde |
if (test == NULL)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("%s\n", dlerror ());
|
|
Packit Service |
82fcde |
exit(1);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
res = test (2);
|
|
Packit Service |
82fcde |
if (res != 4)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("Got %i, expected 4\n", res);
|
|
Packit Service |
82fcde |
exit (1);
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
dlclose (handle);
|
|
Packit Service |
82fcde |
return 0;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#define TEST_FUNCTION do_test ()
|
|
Packit Service |
82fcde |
#include "../test-skeleton.c"
|