]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-RTLD_NOLOAD.dtest/init-main.c
dyld-851.27.tar.gz
[apple/dyld.git] / testing / test-cases / dlopen-RTLD_NOLOAD.dtest / init-main.c
1
2 // BUILD: $CC init-b.c -dynamiclib -DRUN_DIR="$RUN_DIR" -install_name $RUN_DIR/libInitB.dylib -o $BUILD_DIR/libInitB.dylib
3 // BUILD: $CC init-a.c -dynamiclib -install_name $RUN_DIR/libInitA.dylib $BUILD_DIR/libInitB.dylib -o $BUILD_DIR/libInitA.dylib
4 // BUILD: $CC init-main.c $BUILD_DIR/libInitA.dylib -o $BUILD_DIR/dlopen-RTLD_NOLOAD-in-initializer.exe
5
6 // RUN: ./dlopen-RTLD_NOLOAD-in-initializer.exe
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11 #include <stdbool.h>
12 #include <dlfcn.h>
13
14 #include "test_support.h"
15
16 extern bool initsInWrongOrder;
17 extern bool allInitsDone();
18
19 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
20 ///
21 /// This tests that using RTLD_NOLOAD in an initializer does not trigger out of order initializers
22 ///
23 if ( initsInWrongOrder )
24 FAIL("wrong init order");
25 else if ( !allInitsDone() )
26 FAIL("all initializers not run");
27 else
28 PASS("Success");
29 }