Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

102 rader
3.5 KiB

  1. /* GMODULE - GLIB wrapper code for dynamic module loading
  2. * Copyright (C) 1998 Tim Janik
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17. * Boston, MA 02111-1307, USA.
  18. */
  19. /*
  20. * Modified by the GLib Team and others 1997-2000. See the AUTHORS
  21. * file for a list of people on the GLib Team. See the ChangeLog
  22. * files for a list of changes. These files are distributed with
  23. * GLib at ftp://ftp.gtk.org/pub/gtk/.
  24. */
  25. #ifndef __GMODULE_H__
  26. #define __GMODULE_H__
  27. #include <glib.h>
  28. G_BEGIN_DECLS
  29. /* exporting and importing functions, this is special cased
  30. * to feature Windows dll stubs.
  31. */
  32. #define G_MODULE_IMPORT extern
  33. #ifdef G_PLATFORM_WIN32
  34. # define G_MODULE_EXPORT __declspec(dllexport)
  35. #else /* !G_PLATFORM_WIN32 */
  36. # define G_MODULE_EXPORT
  37. #endif /* !G_PLATFORM_WIN32 */
  38. typedef enum
  39. {
  40. G_MODULE_BIND_LAZY = 1 << 0,
  41. G_MODULE_BIND_LOCAL = 1 << 1,
  42. G_MODULE_BIND_MASK = 0x03
  43. } GModuleFlags;
  44. typedef struct _GModule GModule;
  45. typedef const gchar* (*GModuleCheckInit) (GModule *module);
  46. typedef void (*GModuleUnload) (GModule *module);
  47. #ifdef G_OS_WIN32
  48. #define g_module_open g_module_open_utf8
  49. #define g_module_name g_module_name_utf8
  50. #endif
  51. /* return TRUE if dynamic module loading is supported */
  52. gboolean g_module_supported (void) G_GNUC_CONST;
  53. /* open a module `file_name' and return handle, which is NULL on error */
  54. GModule* g_module_open (const gchar *file_name,
  55. GModuleFlags flags);
  56. /* close a previously opened module, returns TRUE on success */
  57. gboolean g_module_close (GModule *module);
  58. /* make a module resident so g_module_close on it will be ignored */
  59. void g_module_make_resident (GModule *module);
  60. /* query the last module error as a string */
  61. G_CONST_RETURN gchar* g_module_error (void);
  62. /* retrieve a symbol pointer from `module', returns TRUE on success */
  63. gboolean g_module_symbol (GModule *module,
  64. const gchar *symbol_name,
  65. gpointer *symbol);
  66. /* retrieve the file name from an existing module */
  67. G_CONST_RETURN gchar* g_module_name (GModule *module);
  68. /* Build the actual file name containing a module. `directory' is the
  69. * directory where the module file is supposed to be, or NULL or empty
  70. * in which case it should either be in the current directory or, on
  71. * some operating systems, in some standard place, for instance on the
  72. * PATH. Hence, to be absoultely sure to get the correct module,
  73. * always pass in a directory. The file name consists of the directory,
  74. * if supplied, and `module_name' suitably decorated accoring to
  75. * the operating system's conventions (for instance lib*.so or *.dll).
  76. *
  77. * No checks are made that the file exists, or is of correct type.
  78. */
  79. gchar* g_module_build_path (const gchar *directory,
  80. const gchar *module_name);
  81. G_END_DECLS
  82. #endif /* __GMODULE_H__ */