Home | History | Annotate | Download | only in utils
      1 /* Copyright (C) 2011 The Android Open Source Project
      2 **
      3 ** This software is licensed under the terms of the GNU General Public
      4 ** License version 2, as published by the Free Software Foundation, and
      5 ** may be copied, distributed, and modified under those terms.
      6 **
      7 ** This program is distributed in the hope that it will be useful,
      8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
      9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     10 ** GNU General Public License for more details.
     11 */
     12 #ifndef ANDROID_UTILS_DLL_H
     13 #define ANDROID_UTILS_DLL_H
     14 
     15 #include "android/utils/compiler.h"
     16 
     17 ANDROID_BEGIN_HEADER
     18 
     19 /* Opaque type to model a dynamic library handle */
     20 typedef struct ADynamicLibrary   ADynamicLibrary;
     21 
     22 /* Try to load/open a dynamic library named 'libraryName', looking for
     23  * it in the optional paths listed by 'libraryPaths'.
     24  *
     25  * Once opened, you can use adynamicLibrary_findSymbol() and
     26  * adynamicLibrary_close() on it.
     27  *
     28  * libraryName :: library name, if no extension is provided, then '.so'
     29  *                will be appended on Unix systems, or '.dll' on Windows.
     30  *
     31  * pError :: On success, '*pError' will be set to NULL. On error, it will
     32  *           point to a string describing the error, which must be freed by
     33  *           the caller.
     34  *
     35  * returns an ADynamicLibrary pointer.
     36  */
     37 ADynamicLibrary*   adynamicLibrary_open( const char*  libraryName,
     38                                          char**       pError);
     39 
     40 /* Find a symbol inside a dynamic library. */
     41 void* adynamicLibrary_findSymbol( ADynamicLibrary*  lib,
     42                                   const char*       symbolName,
     43                                   char**            pError);
     44 
     45 /* Close/unload a given dynamic library */
     46 void  adynamicLibrary_close( ADynamicLibrary*  lib );
     47 
     48 ANDROID_END_HEADER
     49 
     50 #endif /* ANDROID_UTILS_DLL_H */
     51