1/* lt_error.h -- error propagation interface
2
3 Copyright (C) 1999-2001, 2004, 2007, 2011-2015 Free Software
4 Foundation, Inc.
5 Written by Thomas Tanner, 1999
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/* Only include this header file once. */
33#if !defined LT_ERROR_H
34#define LT_ERROR_H 1
35
36#include <libltdl/lt_system.h>
37
38LT_BEGIN_C_DECLS
39
40/* Defining error strings alongside their symbolic names in a macro in
41 this way allows us to expand the macro in different contexts with
42 confidence that the enumeration of symbolic names will map correctly
43 onto the table of error strings. \0 is appended to the strings to
44 expilicitely initialize the string terminator. */
45#define lt_dlerror_table \
46 LT_ERROR(UNKNOWN, "unknown error\0") \
47 LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \
48 LT_ERROR(INVALID_LOADER, "invalid loader\0") \
49 LT_ERROR(INIT_LOADER, "loader initialization failed\0") \
50 LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \
51 LT_ERROR(FILE_NOT_FOUND, "file not found\0") \
52 LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \
53 LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \
54 LT_ERROR(CANNOT_OPEN, "can't open the module\0") \
55 LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \
56 LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \
57 LT_ERROR(NO_MEMORY, "not enough memory\0") \
58 LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \
59 LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \
60 LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \
61 LT_ERROR(SHUTDOWN, "library already shutdown\0") \
62 LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \
63 LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\
64 LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\
65 LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0")
66
67/* Enumerate the symbolic error names. */
68enum {
69#define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name),
70 lt_dlerror_table
71#undef LT_ERROR
72
73 LT_ERROR_MAX
74};
75
76/* Should be max of the error string lengths above (plus one for C++) */
77#define LT_ERROR_LEN_MAX (41)
78
79/* These functions are only useful from inside custom module loaders. */
80LT_SCOPE int lt_dladderror (const char *diagnostic);
81LT_SCOPE int lt_dlseterror (int errorcode);
82
83
84LT_END_C_DECLS
85
86#endif /*!defined LT_ERROR_H*/
87