]> git.ipfire.org Git - thirdparty/gcc.git/blob - libvtv/testsuite/other-tests/dlopen.cc
Fix PR 58300...
[thirdparty/gcc.git] / libvtv / testsuite / other-tests / dlopen.cc
1 #include <stdlib.h>
2 #include <dlfcn.h>
3 #include <stdio.h>
4
5
6
7 typedef void (*voidfn)(void);
8
9 int failures = 0;
10
11 void
12 __vtv_verify_fail (void **data_set_ptr, const void *vtbl_pointer)
13 {
14 failures++;
15 return;
16 }
17
18
19 int 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 }