gmodule.pp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. {$smartlink on}
  24. {$endif}
  25. uses
  26. glib;
  27. {$ifdef win32}
  28. const
  29. gmoduledll='libgmodule-2.0-0';
  30. {$define gtkwin}
  31. {$packrecords C}
  32. {$else}
  33. {$ifdef os2}
  34. const
  35. gmoduledll='gmodule';
  36. {$define gtkos2}
  37. {$packrecords C}
  38. {$else}
  39. const
  40. gmoduledll='gmodule';
  41. {$packrecords C}
  42. {$endif}
  43. {$endif}
  44. {$ifndef gtkos2}
  45. var
  46. g_log_domain_gmodule : Pgchar;external gmoduledll name 'g_log_domain_gmodule';
  47. {$endif}
  48. type
  49. PGModule=pointer;
  50. TGModuleFlags = longint;
  51. const
  52. G_MODULE_BIND_LAZY = 1 shl 0;
  53. G_MODULE_BIND_MASK = 1;
  54. type
  55. TGModuleCheckInit = function (module:PGModule):Pgchar;cdecl;
  56. TGModuleUnload = procedure (module:PGModule);cdecl;
  57. function g_module_supported:gboolean;cdecl;external gmoduledll name 'g_module_supported';
  58. function g_module_open(file_name:Pgchar; flags:TGModuleFlags):PGModule;cdecl;external gmoduledll name 'g_module_open';
  59. function g_module_close(module:PGModule):gboolean;cdecl;external gmoduledll name 'g_module_close';
  60. procedure g_module_make_resident(module:PGModule);cdecl;external gmoduledll name 'g_module_make_resident';
  61. function g_module_error:Pgchar;cdecl;external gmoduledll name 'g_module_error';
  62. function g_module_symbol(module:PGModule; symbol_name:Pgchar; symbol:Pgpointer):gboolean;cdecl;external gmoduledll name 'g_module_symbol';
  63. function g_module_name(module:PGModule):Pgchar;cdecl;external gmoduledll name 'g_module_name';
  64. function g_module_build_path(directory:Pgchar; module_name:Pgchar):Pgchar;cdecl;external gmoduledll name 'g_module_build_path';
  65. implementation
  66. end.