]> git.ipfire.org Git - thirdparty/gcc.git/blame - libvtv/testsuite/other-tests/dlopen.cc
Update libvtv testsuite so that most of the tests now run under
[thirdparty/gcc.git] / libvtv / testsuite / other-tests / dlopen.cc
CommitLineData
2077db1b
CT
1#include <stdlib.h>
2#include <dlfcn.h>
3#include <stdio.h>
4
5
6
7typedef void (*voidfn)(void);
8
9int failures = 0;
10
11void
12__vtv_verify_fail (void **data_set_ptr, const void *vtbl_pointer)
13{
14 failures++;
15 return;
16}
17
18
19int main()
20{
21 char so_name[] = "so0.so";
22 void * dlhandle = dlopen(so_name, RTLD_NOW);
23 if (!dlhandle)
24 {
25 fprintf(stderr, "dlopen %s error: %s\n", so_name, dlerror());
26 exit(1);
27 }
28 voidfn so_entry = (voidfn)dlsym(dlhandle, "so_entry_0");
29 if (!so_entry)
30 {
31 fprintf(stderr, "dlopen %s dlsym error: %s\n", so_name, dlerror());
32 exit(2);
33 }
34
35 so_entry();
36
37 dlclose(dlhandle);
38}