libg722_1  0.0.1
lt_dlloader.h
00001 /* lt_dlloader.h -- dynamic library loader interface
00002 
00003    Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
00004    Written by Gary V. Vaughan, 2004
00005 
00006    NOTE: The canonical source of this file is maintained with the
00007    GNU Libtool package.  Report bugs to bug-libtool@gnu.org.
00008 
00009 GNU Libltdl is free software; you can redistribute it and/or
00010 modify it under the terms of the GNU Lesser General Public
00011 License as published by the Free Software Foundation; either
00012 version 2 of the License, or (at your option) any later version.
00013 
00014 As a special exception to the GNU Lesser General Public License,
00015 if you distribute this file as part of a program or library that
00016 is built using GNU Libtool, you may include this file under the
00017 same distribution terms that you use for the rest of that program.
00018 
00019 GNU Libltdl is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 GNU Lesser General Public License for more details.
00023 
00024 You should have received a copy of the GNU Lesser General Public
00025 License along with GNU Libltdl; see the file COPYING.LIB.  If not, a
00026 copy can be downloaded from  http://www.gnu.org/licenses/lgpl.html,
00027 or obtained by writing to the Free Software Foundation, Inc.,
00028 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00029 */
00030 
00031 #if !defined(LT_DLLOADER_H)
00032 #define LT_DLLOADER_H 1
00033 
00034 #include <libltdl/lt_system.h>
00035 
00036 LT_BEGIN_C_DECLS
00037 
00038 typedef void *  lt_dlloader;
00039 typedef void *  lt_module;
00040 typedef void *  lt_user_data;
00041 typedef struct lt__advise *     lt_dladvise;
00042 
00043 /* Function pointer types for module loader vtable entries:  */
00044 typedef lt_module   lt_module_open      (lt_user_data data,
00045                                          const char *filename,
00046                                          lt_dladvise advise);
00047 typedef int         lt_module_close     (lt_user_data data,
00048                                          lt_module module);
00049 typedef void *      lt_find_sym         (lt_user_data data, lt_module module,
00050                                          const char *symbolname);
00051 typedef int         lt_dlloader_init    (lt_user_data data);
00052 typedef int         lt_dlloader_exit    (lt_user_data data);
00053 
00054 /* Default priority is LT_DLLOADER_PREPEND if none is explicitly given.  */
00055 typedef enum {
00056   LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND
00057 } lt_dlloader_priority;
00058 
00059 /* This structure defines a module loader, as populated by the get_vtable
00060    entry point of each loader.  */
00061 typedef struct {
00062   const char *          name;
00063   const char *          sym_prefix;
00064   lt_module_open *      module_open;
00065   lt_module_close *     module_close;
00066   lt_find_sym *         find_sym;
00067   lt_dlloader_init *    dlloader_init;
00068   lt_dlloader_exit *    dlloader_exit;
00069   lt_user_data          dlloader_data;
00070   lt_dlloader_priority  priority;
00071 } lt_dlvtable;
00072 
00073 LT_SCOPE int            lt_dlloader_add    (const lt_dlvtable *vtable);
00074 LT_SCOPE lt_dlloader    lt_dlloader_next   (const lt_dlloader loader);
00075 
00076 LT_SCOPE lt_dlvtable *  lt_dlloader_remove      (const char *name);
00077 LT_SCOPE const lt_dlvtable *lt_dlloader_find    (const char *name);
00078 LT_SCOPE const lt_dlvtable *lt_dlloader_get     (lt_dlloader loader);
00079 
00080 
00081 /* Type of a function to get a loader's vtable:  */
00082 typedef  const lt_dlvtable *lt_get_vtable       (lt_user_data data);
00083 
00084 #ifdef LT_DEBUG_LOADERS
00085 LT_SCOPE void           lt_dlloader_dump        (void);
00086 #endif
00087 
00088 LT_END_C_DECLS
00089 
00090 #endif /*!defined(LT_DLLOADER_H)*/