• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

ltdl.h

Go to the documentation of this file.
00001 /* ltdl.h -- generic dlopen functions
00002 
00003    Copyright (C) 1998-2000, 2004, 2005,
00004                  2007, 2008 Free Software Foundation, Inc.
00005    Written by Thomas Tanner, 1998
00006 
00007    NOTE: The canonical source of this file is maintained with the
00008    GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
00009 
00010 GNU Libltdl is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU Lesser General Public
00012 License as published by the Free Software Foundation; either
00013 version 2 of the License, or (at your option) any later version.
00014 
00015 As a special exception to the GNU Lesser General Public License,
00016 if you distribute this file as part of a program or library that
00017 is built using GNU Libtool, you may include this file under the
00018 same distribution terms that you use for the rest of that program.
00019 
00020 GNU Libltdl is distributed in the hope that it will be useful,
00021 but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 GNU Lesser General Public License for more details.
00024 
00025 You should have received a copy of the GNU Lesser General Public
00026 License along with GNU Libltdl; see the file COPYING.LIB.  If not, a
00027 copy can be downloaded from  http://www.gnu.org/licenses/lgpl.html,
00028 or obtained by writing to the Free Software Foundation, Inc.,
00029 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00030 */
00031 
00032 /* Only include this header file once. */
00033 #if !defined(LTDL_H)
00034 #define LTDL_H 1
00035 
00036 #include <libltdl/lt_system.h>
00037 #include <libltdl/lt_error.h>
00038 #include <libltdl/lt_dlloader.h>
00039 
00040 LT_BEGIN_C_DECLS
00041 
00042 
00043 /* LT_STRLEN can be used safely on NULL pointers.  */
00044 #define LT_STRLEN(s)    (((s) && (s)[0]) ? strlen (s) : 0)
00045 
00046 
00047 /* --- DYNAMIC MODULE LOADING API --- */
00048 
00049 
00050 typedef struct lt__handle *lt_dlhandle; /* A loaded module.  */
00051 
00052 /* Initialisation and finalisation functions for libltdl. */
00053 LT_SCOPE int        lt_dlinit           (void);
00054 LT_SCOPE int        lt_dlexit           (void);
00055 
00056 /* Module search path manipulation.  */
00057 LT_SCOPE int        lt_dladdsearchdir    (const char *search_dir);
00058 LT_SCOPE int        lt_dlinsertsearchdir (const char *before,
00059                                                   const char *search_dir);
00060 LT_SCOPE int        lt_dlsetsearchpath   (const char *search_path);
00061 LT_SCOPE const char *lt_dlgetsearchpath  (void);
00062 LT_SCOPE int        lt_dlforeachfile     (
00063                         const char *search_path,
00064                         int (*func) (const char *filename, void *data),
00065                         void *data);
00066 
00067 /* User module loading advisors.  */
00068 LT_SCOPE int        lt_dladvise_init     (lt_dladvise *advise);
00069 LT_SCOPE int        lt_dladvise_destroy  (lt_dladvise *advise);
00070 LT_SCOPE int        lt_dladvise_ext      (lt_dladvise *advise);
00071 LT_SCOPE int        lt_dladvise_resident (lt_dladvise *advise);
00072 LT_SCOPE int        lt_dladvise_local    (lt_dladvise *advise);
00073 LT_SCOPE int        lt_dladvise_global   (lt_dladvise *advise);
00074 LT_SCOPE int        lt_dladvise_preload  (lt_dladvise *advise);
00075 
00076 /* Portable libltdl versions of the system dlopen() API. */
00077 LT_SCOPE lt_dlhandle lt_dlopen          (const char *filename);
00078 LT_SCOPE lt_dlhandle lt_dlopenext       (const char *filename);
00079 LT_SCOPE lt_dlhandle lt_dlopenadvise    (const char *filename,
00080                                          lt_dladvise advise);
00081 LT_SCOPE void *     lt_dlsym            (lt_dlhandle handle, const char *name);
00082 LT_SCOPE const char *lt_dlerror         (void);
00083 LT_SCOPE int        lt_dlclose          (lt_dlhandle handle);
00084 
00085 
00086 
00087 /* --- PRELOADED MODULE SUPPORT --- */
00088 
00089 
00090 /* A preopened symbol. Arrays of this type comprise the exported
00091    symbols for a dlpreopened module. */
00092 typedef struct {
00093   const char *name;
00094   void       *address;
00095 } lt_dlsymlist;
00096 
00097 typedef int lt_dlpreload_callback_func (lt_dlhandle handle);
00098 
00099 LT_SCOPE int    lt_dlpreload         (const lt_dlsymlist *preloaded);
00100 LT_SCOPE int    lt_dlpreload_default (const lt_dlsymlist *preloaded);
00101 LT_SCOPE int    lt_dlpreload_open    (const char *originator,
00102                                       lt_dlpreload_callback_func *func);
00103 
00104 #define lt_preloaded_symbols    lt__PROGRAM__LTX_preloaded_symbols
00105 #define LTDL_SET_PRELOADED_SYMBOLS()                    LT_STMT_START{  \
00106         extern const lt_dlsymlist lt_preloaded_symbols[];               \
00107         lt_dlpreload_default(lt_preloaded_symbols);                     \
00108                                                         }LT_STMT_END
00109 
00110 
00111 
00112 
00113 /* --- MODULE INFORMATION --- */
00114 
00115 
00116 /* Associating user data with loaded modules. */
00117 typedef void * lt_dlinterface_id;
00118 typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string);
00119 
00120 LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string,
00121                                           lt_dlhandle_interface *iface);
00122 LT_SCOPE void   lt_dlinterface_free (lt_dlinterface_id key);
00123 LT_SCOPE void * lt_dlcaller_set_data  (lt_dlinterface_id key,
00124                                           lt_dlhandle handle, void *data);
00125 LT_SCOPE void * lt_dlcaller_get_data  (lt_dlinterface_id key,
00126                                           lt_dlhandle handle);
00127 
00128 
00129 /* Read only information pertaining to a loaded module. */
00130 typedef struct {
00131   char *        filename;       /* file name */
00132   char *        name;           /* module name */
00133   int           ref_count;      /* number of times lt_dlopened minus
00134                                    number of times lt_dlclosed. */
00135   unsigned int  is_resident:1;  /* module can't be unloaded. */
00136   unsigned int  is_symglobal:1; /* module symbols can satisfy
00137                                    subsequently loaded modules.  */
00138   unsigned int  is_symlocal:1;  /* module symbols are only available
00139                                    locally. */
00140 } lt_dlinfo;
00141 
00142 LT_SCOPE const lt_dlinfo *lt_dlgetinfo      (lt_dlhandle handle);
00143 
00144 LT_SCOPE lt_dlhandle    lt_dlhandle_iterate (lt_dlinterface_id iface,
00145                                              lt_dlhandle place);
00146 LT_SCOPE lt_dlhandle    lt_dlhandle_fetch   (lt_dlinterface_id iface,
00147                                              const char *module_name);
00148 LT_SCOPE int            lt_dlhandle_map     (lt_dlinterface_id iface,
00149                                 int (*func) (lt_dlhandle handle, void *data),
00150                                 void *data);
00151 
00152 
00153 
00154 /* Deprecated module residency management API. */
00155 LT_SCOPE int        lt_dlmakeresident   (lt_dlhandle handle);
00156 LT_SCOPE int        lt_dlisresident     (lt_dlhandle handle);
00157 
00158 #define lt_ptr void *
00159 
00160 LT_END_C_DECLS
00161 
00162 #endif 

Generated on Thu Sep 30 2010 14:35:00 for Gnash by  doxygen 1.7.1