lt_error.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* lt_error.h -- error propagation interface
  2. Copyright (C) 1999-2001, 2004, 2007, 2011-2015 Free Software
  3. Foundation, Inc.
  4. Written by Thomas Tanner, 1999
  5. NOTE: The canonical source of this file is maintained with the
  6. GNU Libtool package. Report bugs to bug-libtool@gnu.org.
  7. GNU Libltdl is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU Lesser General Public
  9. License as published by the Free Software Foundation; either
  10. version 2 of the License, or (at your option) any later version.
  11. As a special exception to the GNU Lesser General Public License,
  12. if you distribute this file as part of a program or library that
  13. is built using GNU Libtool, you may include this file under the
  14. same distribution terms that you use for the rest of that program.
  15. GNU Libltdl is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. GNU Lesser General Public License for more details.
  19. You should have received a copy of the GNU Lesser General Public
  20. License along with GNU Libltdl; see the file COPYING.LIB. If not, a
  21. copy can be downloaded from http://www.gnu.org/licenses/lgpl.html,
  22. or obtained by writing to the Free Software Foundation, Inc.,
  23. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  24. */
  25. /* Only include this header file once. */
  26. #if !defined LT_ERROR_H
  27. #define LT_ERROR_H 1
  28. #include <libltdl/lt_system.h>
  29. LT_BEGIN_C_DECLS
  30. /* Defining error strings alongside their symbolic names in a macro in
  31. this way allows us to expand the macro in different contexts with
  32. confidence that the enumeration of symbolic names will map correctly
  33. onto the table of error strings. \0 is appended to the strings to
  34. expilicitely initialize the string terminator. */
  35. #define lt_dlerror_table \
  36. LT_ERROR(UNKNOWN, "unknown error\0") \
  37. LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \
  38. LT_ERROR(INVALID_LOADER, "invalid loader\0") \
  39. LT_ERROR(INIT_LOADER, "loader initialization failed\0") \
  40. LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \
  41. LT_ERROR(FILE_NOT_FOUND, "file not found\0") \
  42. LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \
  43. LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \
  44. LT_ERROR(CANNOT_OPEN, "can't open the module\0") \
  45. LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \
  46. LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \
  47. LT_ERROR(NO_MEMORY, "not enough memory\0") \
  48. LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \
  49. LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \
  50. LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \
  51. LT_ERROR(SHUTDOWN, "library already shutdown\0") \
  52. LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \
  53. LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\
  54. LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\
  55. LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0")
  56. /* Enumerate the symbolic error names. */
  57. enum {
  58. #define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name),
  59. lt_dlerror_table
  60. #undef LT_ERROR
  61. LT_ERROR_MAX
  62. };
  63. /* Should be max of the error string lengths above (plus one for C++) */
  64. #define LT_ERROR_LEN_MAX (41)
  65. /* These functions are only useful from inside custom module loaders. */
  66. LT_SCOPE int lt_dladderror (const char *diagnostic);
  67. LT_SCOPE int lt_dlseterror (int errorcode);
  68. LT_END_C_DECLS
  69. #endif /*!defined LT_ERROR_H*/