]>
git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-basic.dtest/main.c
2 // BUILD: $CC foo.c -dynamiclib -o $BUILD_DIR/test.dylib
3 // BUILD: $CC foo.c -bundle -o $BUILD_DIR/test.bundle
4 // BUILD: $CC main.c -o $BUILD_DIR/dlopen-basic.exe
6 // RUN: ./dlopen-basic.exe
12 static void tryImage(const char* path
)
14 printf("[BEGIN] dlopen-basic %s\n", path
);
15 void* handle
= dlopen(path
, RTLD_LAZY
);
16 if ( handle
== NULL
) {
17 printf("dlerror(): %s\n", dlerror());
18 printf("[FAIL] dlopen-basic %s\n", path
);
22 void* sym
= dlsym(handle
, "foo");
24 printf("dlerror(): %s\n", dlerror());
25 printf("[FAIL] dlopen-basic %s\n", path
);
29 int result
= dlclose(handle
);
31 printf("dlclose() returned %d, dlerror()=%s\n", result
, dlerror());
32 printf("[FAIL] dlopen-basic %s\n", path
);
36 printf("[PASS] dlopen-basic %s\n", path
);
43 tryImage("test.bundle");
44 tryImage("test.dylib");