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