]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/netbsd-tests/lib/csu/h_initfini3.cxx
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / netbsd-tests / lib / csu / h_initfini3.cxx
1 #include <dlfcn.h>
2 #include <err.h>
3 #include <unistd.h>
4
5 int
6 main(void)
7 {
8         static const char msg1[] = "main started\n";
9         static const char msg2[] = "main after dlopen\n";
10         static const char msg3[] = "main terminated\n";
11
12         void *handle;
13
14         write(STDOUT_FILENO, msg1, sizeof(msg1) - 1);
15         handle = dlopen("h_initfini3_dso.so", RTLD_NOW | RTLD_LOCAL);
16         if (handle == NULL)
17                 err(1, "dlopen");
18         write(STDOUT_FILENO, msg2, sizeof(msg2) - 1);
19         dlclose(handle);
20         write(STDOUT_FILENO, msg3, sizeof(msg3) - 1);
21         return 0;
22 }