dyld-750.5.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 // BUILD: $CC foo.c foo2.c -dynamiclib -DTEN=1 -install_name $RUN_DIR/libfoo10.dylib -o $BUILD_DIR/libfoo10.dylib
5 // BUILD: $CC main.c $BUILD_DIR/libfoo10.dylib -DTEN=1 -o $BUILD_DIR/symbol-resolver10.exe
6
7 // RUN: ./symbol-resolver.exe
8 // RUN: ./symbol-resolver10.exe
9
10
11 #include <stdio.h>
12 #include <stdlib.h>
13
14 #include "test_support.h"
15
16 extern int foo();
17 extern int fooPlusOne();
18
19
20 int main(int argc, const char* argv[], const char* envp[], const char* apple[]) {
21 #if TEN
22 if ( foo() != 10 )
23 FAIL("foo() != 10");
24 else if ( fooPlusOne() != 11 )
25 FAIL("fooPlusOne() != 11");
26 else
27 PASS("Success");
28 #else
29 if ( foo() != 0 )
30 FAIL("foo() != 0");
31 else if ( fooPlusOne() != 1 )
32 FAIL("fooPlusOne() != 1");
33 else
34 PASS("Success");
35 #endif
36
37 return 0;
38 }