| Dmitriy Ivanov | 76ac1ac | 2015-04-01 14:45:10 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2014 The Android Open Source Project | 
|  | 3 | * | 
|  | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 5 | * you may not use this file except in compliance with the License. | 
|  | 6 | * You may obtain a copy of the License at | 
|  | 7 | * | 
|  | 8 | *      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 9 | * | 
|  | 10 | * Unless required by applicable law or agreed to in writing, software | 
|  | 11 | * distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 13 | * See the License for the specific language governing permissions and | 
|  | 14 | * limitations under the License. | 
|  | 15 | */ | 
|  | 16 | #include <dlfcn.h> | 
|  | 17 | #include <stdio.h> | 
|  | 18 |  | 
|  | 19 | int test_dlsym_symbol = 42; | 
|  | 20 |  | 
|  | 21 | extern "C" int* lookup_dlsym_symbol_using_RTLD_DEFAULT() { | 
|  | 22 | dlerror(); | 
|  | 23 | int* result = static_cast<int*>(dlsym(RTLD_DEFAULT, "test_dlsym_symbol")); | 
|  | 24 | // TODO: remove this once b/20049306 is fixed | 
|  | 25 | if (result == nullptr) { | 
|  | 26 | printf("Cannot find the answer\n"); | 
|  | 27 | } | 
|  | 28 | return result; | 
|  | 29 | } | 
|  | 30 |  |