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