1 // REQUIRES: host-supports-jit, x86_64-linux
3 // To generate libdynamic-library-test.so :
4 // clang -xc++ -o libdynamic-library-test.so -fPIC -shared
8 // int ultimate_answer = 0;
10 // int calculate_answer() {
11 // ultimate_answer = 42;
17 // RUN: cat %s | env LD_LIBRARY_PATH=%S/Inputs:$LD_LIBRARY_PATH clang-repl | FileCheck %s
19 extern "C" int printf(const char* format
, ...);
21 extern "C" int ultimate_answer
;
22 extern "C" int calculate_answer();
24 %lib libdynamic
-library
-test
.so
26 printf("Return value: %d\n", calculate_answer());
27 // CHECK: Return value: 5
29 printf("Variable: %d\n", ultimate_answer
);
30 // CHECK-NEXT: Variable: 42