lt_dlloader.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* lt_dlloader.h -- dynamic library loader interface
  2. Copyright (C) 2004, 2007-2008, 2011-2015 Free Software Foundation,
  3. Inc.
  4. Written by Gary V. Vaughan, 2004
  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. #if !defined LT_DLLOADER_H
  26. #define LT_DLLOADER_H 1
  27. #include <libltdl/lt_system.h>
  28. LT_BEGIN_C_DECLS
  29. typedef void * lt_dlloader;
  30. typedef void * lt_module;
  31. typedef void * lt_user_data;
  32. typedef struct lt__advise * lt_dladvise;
  33. /* Function pointer types for module loader vtable entries: */
  34. typedef lt_module lt_module_open (lt_user_data data,
  35. const char *filename,
  36. lt_dladvise advise);
  37. typedef int lt_module_close (lt_user_data data,
  38. lt_module module);
  39. typedef void * lt_find_sym (lt_user_data data, lt_module module,
  40. const char *symbolname);
  41. typedef int lt_dlloader_init (lt_user_data data);
  42. typedef int lt_dlloader_exit (lt_user_data data);
  43. /* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */
  44. typedef enum {
  45. LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND
  46. } lt_dlloader_priority;
  47. /* This structure defines a module loader, as populated by the get_vtable
  48. entry point of each loader. */
  49. typedef struct {
  50. const char * name;
  51. const char * sym_prefix;
  52. lt_module_open * module_open;
  53. lt_module_close * module_close;
  54. lt_find_sym * find_sym;
  55. lt_dlloader_init * dlloader_init;
  56. lt_dlloader_exit * dlloader_exit;
  57. lt_user_data dlloader_data;
  58. lt_dlloader_priority priority;
  59. } lt_dlvtable;
  60. LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable);
  61. LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader);
  62. LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name);
  63. LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name);
  64. LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader);
  65. /* Type of a function to get a loader's vtable: */
  66. typedef const lt_dlvtable *lt_get_vtable (lt_user_data data);
  67. #ifdef LT_DEBUG_LOADERS
  68. LT_SCOPE void lt_dlloader_dump (void);
  69. #endif
  70. LT_END_C_DECLS
  71. #endif /*!defined LT_DLLOADER_H*/