gmodule.pp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. {
  2. GMODULE - GLIB wrapper code for dynamic module loading
  3. Copyright (C) 1998 Tim Janik
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library 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. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public
  13. License along with this library; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. }
  17. unit gmodule;
  18. interface
  19. {$mode objfpc}
  20. { Always use smartlinking for win32, this solves some undefined functions
  21. in the development gtk versions which change often (PFV) }
  22. {$ifdef win32}
  23. {$ifndef NO_SMART_LINK}
  24. {$smartlink on}
  25. {$endif}
  26. {$endif}
  27. uses
  28. glib;
  29. {$ifdef win32}
  30. const
  31. gmoduledll='libgmodule-2.0-0';
  32. {$define gtkwin}
  33. {$packrecords C}
  34. {$else}
  35. {$ifdef os2}
  36. const
  37. gmoduledll='gmodule';
  38. {$define gtkos2}
  39. {$packrecords C}
  40. {$else}
  41. const
  42. gmoduledll='gmodule';
  43. {$packrecords C}
  44. {$endif}
  45. {$endif}
  46. {$ifndef gtkos2}
  47. var
  48. g_log_domain_gmodule : Pgchar;external gmoduledll name 'g_log_domain_gmodule';
  49. {$endif}
  50. type
  51. PGModule=pointer;
  52. TGModuleFlags = longint;
  53. const
  54. G_MODULE_BIND_LAZY = 1 shl 0;
  55. G_MODULE_BIND_MASK = 1;
  56. type
  57. TGModuleCheckInit = function (module:PGModule):Pgchar;cdecl;
  58. TGModuleUnload = procedure (module:PGModule);cdecl;
  59. function g_module_supported:gboolean;cdecl;external gmoduledll name 'g_module_supported';
  60. function g_module_open(file_name:Pgchar; flags:TGModuleFlags):PGModule;cdecl;external gmoduledll name 'g_module_open';
  61. function g_module_close(module:PGModule):gboolean;cdecl;external gmoduledll name 'g_module_close';
  62. procedure g_module_make_resident(module:PGModule);cdecl;external gmoduledll name 'g_module_make_resident';
  63. function g_module_error:Pgchar;cdecl;external gmoduledll name 'g_module_error';
  64. function g_module_symbol(module:PGModule; symbol_name:Pgchar; symbol:Pgpointer):gboolean;cdecl;external gmoduledll name 'g_module_symbol';
  65. function g_module_name(module:PGModule):Pgchar;cdecl;external gmoduledll name 'g_module_name';
  66. function g_module_build_path(directory:Pgchar; module_name:Pgchar):Pgchar;cdecl;external gmoduledll name 'g_module_build_path';
  67. implementation
  68. end.