]> git.saurik.com Git - apple/dyld.git/blob - testing/test-cases/dlopen-in-init.dtest/foo.c
5f91679587c7dd039ce1d1c770e3caf59f15e1c9
[apple/dyld.git] / testing / test-cases / dlopen-in-init.dtest / foo.c
1
2
3 #include <stdio.h>
4 #include <dlfcn.h>
5 #include <stdlib.h>
6 #include <dispatch/dispatch.h>
7 #include <stdbool.h>
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <pthread.h>
11 #include <assert.h>
12 #include <unistd.h>
13
14
15 static void* work1(void* arg)
16 {
17 void* h = dlopen("System/Library/Frameworks/Foundation.framework/Foundation", 0);
18
19 return NULL;
20 }
21
22
23 __attribute__((constructor))
24 void myinit()
25 {
26 pthread_t workerThread;
27
28 if ( pthread_create(&workerThread, NULL, work1, NULL) != 0 ) {
29 printf("[FAIL] dlopen-in-init, pthread_create\n");
30 return;
31 }
32
33 void* dummy;
34 pthread_join(workerThread, &dummy);
35 }
36