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
10GNU Libltdl is free software; you can redistribute it and/or
11modify it under the terms of the GNU Lesser General Public
12License as published by the Free Software Foundation; either
13version 2 of the License, or (at your option) any later version.
14
15As a special exception to the GNU Lesser General Public License,
16if you distribute this file as part of a program or library that
17is built using GNU Libtool, you may include this file under the
18same distribution terms that you use for the rest of that program.
19
20GNU Libltdl is distributed in the hope that it will be useful,
21but WITHOUT ANY WARRANTY; without even the implied warranty of
22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23GNU Lesser General Public License for more details.
24
25You should have received a copy of the GNU Lesser General Public
26License along with GNU Libltdl; see the file COPYING.LIB. If not, a
27copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
28or obtained by writing to the Free Software Foundation, Inc.,
2951 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
37LT_BEGIN_C_DECLS
38
39typedef void * lt_dlloader;
40typedef void * lt_module;
41typedef void * lt_user_data;
42typedef struct lt__advise * lt_dladvise;
43
44/* Function pointer types for module loader vtable entries: */
45typedef lt_module lt_module_open (lt_user_data data,
46 const char *filename,
47 lt_dladvise advise);
48typedef int lt_module_close (lt_user_data data,
49 lt_module module);
50typedef void * lt_find_sym (lt_user_data data, lt_module module,
51 const char *symbolname);
52typedef int lt_dlloader_init (lt_user_data data);
53typedef int lt_dlloader_exit (lt_user_data data);
54
55/* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */
56typedef 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. */
62typedef 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
74LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable);
75LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader);
76
77LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name);
78LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name);
79LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader);
80
81
82/* Type of a function to get a loader's vtable: */
83typedef const lt_dlvtable *lt_get_vtable (lt_user_data data);
84
85#ifdef LT_DEBUG_LOADERS
86LT_SCOPE void lt_dlloader_dump (void);
87#endif
88
89LT_END_C_DECLS
90
91#endif /*!defined LT_DLLOADER_H*/
92