gcc/libvtv/testsuite/other-tests/dlopen.cc
Caroline Tice 41e96dc8f0 Update libvtv testsuite so that most of the tests now run under
the dejagnu test harness.

From-SVN: r202373
2013-09-08 16:35:14 -07:00

39 lines
629 B
C++

#include <stdlib.h>
#include <dlfcn.h>
#include <stdio.h>
typedef void (*voidfn)(void);
int failures = 0;
void
__vtv_verify_fail (void **data_set_ptr, const void *vtbl_pointer)
{
failures++;
return;
}
int main()
{
char so_name[] = "so0.so";
void * dlhandle = dlopen(so_name, RTLD_NOW);
if (!dlhandle)
{
fprintf(stderr, "dlopen %s error: %s\n", so_name, dlerror());
exit(1);
}
voidfn so_entry = (voidfn)dlsym(dlhandle, "so_entry_0");
if (!so_entry)
{
fprintf(stderr, "dlopen %s dlsym error: %s\n", so_name, dlerror());
exit(2);
}
so_entry();
dlclose(dlhandle);
}