dyld-750.5.tar.gz
[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 #include "test_support.h"
8
9 bool doneInitB = false;
10 bool inInitB = false;
11
12
13 __attribute__((constructor))
14 void initB(int argc, const char* argv[], const char* envp[], const char* apple[])
15 {
16 inInitB = true;
17
18 // "upward" link to libInitA.dylib
19 void* handle = dlopen(RUN_DIR "/libInitA.dylib", RTLD_NOLOAD);
20 if ( handle == NULL ) {
21 FAIL("dlopen(\"libInitA.dylib\", RTLD_NOLOAD) failed but it should have worked: %s", dlerror());
22 return;
23 }
24 inInitB = false;
25
26 doneInitB = true;
27 }