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