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