]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-RTLD_NOLOAD.dtest/init-b.c
81bc32eb783c47c3b42868867f61aa84ea561bd3
[apple/dyld.git] / testing / test-cases / dlopen-RTLD_NOLOAD.dtest / init-b.c
1
2 #include <stddef.h>
3 #include <stdbool.h>
4 #include <stdio.h>
5 #include <dlfcn.h>
6
7 bool doneInitB = false;
8 bool inInitB = false;
9
10
11 __attribute__((constructor))
12 void initB()
13 {
14 inInitB = true;
15
16 // "upward" link to libInitA.dylib
17 void* handle = dlopen(RUN_DIR "/libInitA.dylib", RTLD_NOLOAD);
18 if ( handle == NULL ) {
19 printf("[FAIL] dlopen-RTLD_NOLOAD-in-initializer: dlopen(libInitA.dylib, RTLD_NOLOAD) failed but it should have worked: %s\n", dlerror());
20 return;
21 }
22 inInitB = false;
23
24 doneInitB = true;
25 }