]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-in-init2.dtest/foo.c
7 extern int bazInited();
9 static void* barHandle
= NULL
;
10 static void* barSymbol
= NULL
;
11 static int fooInited
= 0;
12 static int barInited
= 0;
14 __attribute__((constructor
))
18 barHandle
= dlopen(RUN_DIR
"/libbar.dylib", 0);
19 if ( barHandle
== NULL
) {
20 printf("[FAIL] dlopen-in-init2, dlopen libbar.dylib: %s\n", dlerror());
23 barSymbol
= dlsym(RTLD_DEFAULT
, "barIsInited");
24 if ( barSymbol
== NULL
) {
25 printf("[FAIL] dlopen-in-init2, dlsym libbar.dylib\n");
28 barInited
= ((int(*)())barSymbol
)();
32 if ( fooInited
== 0 ) {
33 printf("[FAIL] dlopen-in-init2, didn't init foo\n");
36 if ( barHandle
== NULL
) {
39 if ( barSymbol
== NULL
) {
42 if ( barInited
== 0 ) {
43 printf("[FAIL] dlopen-in-init2, didn't init bar\n");
46 if ( bazInited() == 0 ) {
47 printf("[FAIL] dlopen-in-init2, didn't init baz\n");