dyld-625.13.tar.gz
[apple/dyld.git] / testing / test-cases / symbol-resolver-basic.dtest / main.c
1
2 // BUILD: $CC foo.c foo2.c -dynamiclib -install_name $RUN_DIR/libfoo.dylib -o $BUILD_DIR/libfoo.dylib
3 // BUILD: $CC main.c $BUILD_DIR/libfoo.dylib -o $BUILD_DIR/symbol-resolver.exe
4
5 // RUN: ./symbol-resolver.exe
6 // RUN: TEN=1 ./symbol-resolver.exe
7
8
9 #include <stdio.h>
10 #include <stdlib.h>
11
12 extern int foo();
13 extern int fooPlusOne();
14
15
16 int main()
17 {
18 if ( getenv("TEN") != NULL ) {
19 if ( foo() != 10 )
20 printf("[FAIL] symbol-resolver-basic: foo() != 10\n");
21 else if ( fooPlusOne() != 11 )
22 printf("[FAIL] symbol-resolver-basic: fooPlusOne() != 11\n");
23 else
24 printf("[PASS] symbol-resolver-basic\n");
25 }
26 else {
27 if ( foo() != 0 )
28 printf("[FAIL] symbol-resolver-basic: foo() != 0\n");
29 else if ( fooPlusOne() != 1 )
30 printf("[FAIL] symbol-resolver-basic: fooPlusOne() != 1\n");
31 else
32 printf("[PASS] symbol-resolver-basic\n");
33 }
34
35 return 0;
36 }