1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AIE_DL_OPERATION_H 17 #define AIE_DL_OPERATION_H 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 const int TYPE_DEFAULT_LOCAL = 1; 24 25 /** 26 * Load dynamic library. 27 * 28 * @param libPath Dynamic library name, including path. 29 * @param type true:RTLD_LOCAL,false: RTLD_GLOBAL. 30 * @return if the result is null that means fail and if the result is not null that means success. 31 */ 32 void *AieDlopen(const char *libPath, int type = TYPE_DEFAULT_LOCAL); 33 34 /** 35 * Get symbol. 36 * 37 * @param libHandle The result which is obtained by AiDlopen. 38 * @param functionName Symbol name. 39 * @return if the result is null that means fail and if the result is not null that means success. 40 */ 41 void *AieDlsym(void *libHandle, const char *functionName); 42 43 /** 44 * Unload dynamic library. 45 * 46 * @param libHandle The result which is obtained by AiDlopen. 47 */ 48 void AieDlclose(void *libHandle); 49 50 /** 51 * Get error information. 52 * 53 * @return error information. 54 */ 55 const char *AieDlerror(); 56 57 #ifdef __cplusplus 58 } 59 #endif 60 61 #endif // AIE_DL_OPERATION_H