cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* lt_dlloader.h -- dynamic library loader interface |
| 2 | |
| 3 | Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc. |
| 4 | Written by Gary V. Vaughan, 2004 |
| 5 | |
| 6 | NOTE: The canonical source of this file is maintained with the |
| 7 | GNU Libtool package. Report bugs to bug-libtool@gnu.org. |
| 8 | |
| 9 | GNU Libltdl is free software; you can redistribute it and/or |
| 10 | modify it under the terms of the GNU Lesser General Public |
| 11 | License as published by the Free Software Foundation; either |
| 12 | version 2 of the License, or (at your option) any later version. |
| 13 | |
| 14 | As a special exception to the GNU Lesser General Public License, |
| 15 | if you distribute this file as part of a program or library that |
| 16 | is built using GNU Libtool, you may include this file under the |
| 17 | same distribution terms that you use for the rest of that program. |
| 18 | |
| 19 | GNU Libltdl is distributed in the hope that it will be useful, |
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 | GNU Lesser General Public License for more details. |
| 23 | |
| 24 | You should have received a copy of the GNU Lesser General Public |
| 25 | License along with GNU Libltdl; see the file COPYING.LIB. If not, a |
| 26 | copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, |
| 27 | or obtained by writing to the Free Software Foundation, Inc., |
| 28 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 29 | */ |
| 30 | |
| 31 | #if !defined(LT_DLLOADER_H) |
| 32 | #define LT_DLLOADER_H 1 |
| 33 | |
| 34 | #include <libltdl/lt_system.h> |
| 35 | |
| 36 | LT_BEGIN_C_DECLS |
| 37 | |
| 38 | typedef void * lt_dlloader; |
| 39 | typedef void * lt_module; |
| 40 | typedef void * lt_user_data; |
| 41 | typedef struct lt__advise * lt_dladvise; |
| 42 | |
| 43 | /* Function pointer types for module loader vtable entries: */ |
| 44 | typedef lt_module lt_module_open (lt_user_data data, |
| 45 | const char *filename, |
| 46 | lt_dladvise advise); |
| 47 | typedef int lt_module_close (lt_user_data data, |
| 48 | lt_module module); |
| 49 | typedef void * lt_find_sym (lt_user_data data, lt_module module, |
| 50 | const char *symbolname); |
| 51 | typedef int lt_dlloader_init (lt_user_data data); |
| 52 | typedef int lt_dlloader_exit (lt_user_data data); |
| 53 | |
| 54 | /* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */ |
| 55 | typedef enum { |
| 56 | LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND |
| 57 | } lt_dlloader_priority; |
| 58 | |
| 59 | /* This structure defines a module loader, as populated by the get_vtable |
| 60 | entry point of each loader. */ |
| 61 | typedef struct { |
| 62 | const char * name; |
| 63 | const char * sym_prefix; |
| 64 | lt_module_open * module_open; |
| 65 | lt_module_close * module_close; |
| 66 | lt_find_sym * find_sym; |
| 67 | lt_dlloader_init * dlloader_init; |
| 68 | lt_dlloader_exit * dlloader_exit; |
| 69 | lt_user_data dlloader_data; |
| 70 | lt_dlloader_priority priority; |
| 71 | } lt_dlvtable; |
| 72 | |
| 73 | LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable); |
| 74 | LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader); |
| 75 | |
| 76 | LT_SCOPE lt_dlvtable * lt_dlloader_remove (char *name); |
| 77 | LT_SCOPE const lt_dlvtable *lt_dlloader_find (char *name); |
| 78 | LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader); |
| 79 | |
| 80 | |
| 81 | /* Type of a function to get a loader's vtable: */ |
| 82 | typedef const lt_dlvtable *lt_get_vtable (lt_user_data data); |
| 83 | |
| 84 | #ifdef LT_DEBUG_LOADERS |
| 85 | LT_SCOPE void lt_dlloader_dump (void); |
| 86 | #endif |
| 87 | |
| 88 | LT_END_C_DECLS |
| 89 | |
| 90 | #endif /*!defined(LT_DLLOADER_H)*/ |