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 /* Opaque type to model a dynamic library handle */
     16 typedef struct ADynamicLibrary   ADynamicLibrary;
     17 
     18 /* Try to load/open a dynamic library named 'libraryName', looking for
     19  * it in the optional paths listed by 'libraryPaths'.
     20  *
     21  * Once opened, you can use adynamicLibrary_findSymbol() and
     22  * adynamicLibrary_close() on it.
     23  *
     24  * libraryName :: library name, if no extension is provided, then '.so'
     25  *                will be appended on Unix systems, or '.dll' on Windows.
     26  *
     27  * pError :: On success, '*pError' will be set to NULL. On error, it will
     28  *           point to a string describing the error, which must be freed by
     29  *           the caller.
     30  *
     31  * returns an ADynamicLibrary pointer.
     32  */
     33 ADynamicLibrary*   adynamicLibrary_open( const char*  libraryName,
     34                                          char**       pError);
     35 
     36 /* Find a symbol inside a dynamic library. */
     37 void* adynamicLibrary_findSymbol( ADynamicLibrary*  lib,
     38                                   const char*       symbolName,
     39                                   char**            pError);
     40 
     41 /* Close/unload a given dynamic library */
     42 void  adynamicLibrary_close( ADynamicLibrary*  lib );
     43 
     44 #endif /* ANDROID_UTILS_DLL_H */
     45