1#include "tst-unique3.h"
2
3#include <cstdio>
4#include "../dlfcn/dlfcn.h"
5
6int t = S<char>::i;
7
8int
9main (void)
10{
11 std::printf (format: "%d %d\n", S<char>::i, t);
12 int result = S<char>::i++ != 1 || t != 1;
13 result |= in_lib ();
14 void *d = dlopen (file: "$ORIGIN/tst-unique3lib2.so", RTLD_LAZY);
15 int (*fp) ();
16 if (d == NULL || (fp = (int(*)()) dlsym (handle: d, name: "in_lib2")) == NULL)
17 {
18 std::printf (format: "failed to get symbol in_lib2\n");
19 return 1;
20 }
21 result |= fp ();
22 dlclose (handle: d);
23 return result;
24}
25

source code of glibc/elf/tst-unique3.cc