1. ----------------------------------------------------------------------- 
  2. --          GtkAda - Ada95 binding for the Gimp Toolkit              -- 
  3. --                                                                   -- 
  4. --                        Copyright (C) 2000                         -- 
  5. --        Emmanuel Briot, Joel Brobecker and Arnaud Charlet          -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU 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. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. --  This package provides wrapper code for dynamic module loading 
  27. --  </description> 
  28. --  <group>Glib, the general-purpose library</group> 
  29.  
  30. package Glib.Module is 
  31.    pragma Preelaborate; 
  32.  
  33.    type Module_Flags is mod 2 ** 32; 
  34.    Module_Bind_Lazy : constant Module_Flags := 2 ** 0; 
  35.    Module_Bind_Mask : constant Module_Flags := 16#1#; 
  36.  
  37.    type G_Module is new C_Proxy; 
  38.  
  39.    function Module_Supported return Boolean; 
  40.    --  Return True if dynamic module loading is supported 
  41.  
  42.    function Module_Open 
  43.      (File_Name : String; 
  44.       Flags     : Module_Flags := Module_Bind_Lazy) return G_Module; 
  45.    --  Open a module `file_name' and return handle, which is null on error. 
  46.  
  47.    function Module_Close (Module : G_Module) return Boolean; 
  48.    --  Close a previously opened module, return True on success. 
  49.  
  50.    procedure Module_Make_Resident (Module : G_Module); 
  51.    --  Make a module resident so Module_Close on it will be ignored 
  52.  
  53.    function Module_Error return String; 
  54.    --  Query the last module error as a string 
  55.  
  56.    generic 
  57.       type Pointer is private; 
  58.       --  This is typically a pointer to procedure/function. 
  59.  
  60.    procedure Generic_Module_Symbol 
  61.      (Module      : G_Module; 
  62.       Symbol_Name : String; 
  63.       Symbol      : out Pointer; 
  64.       Success     : out Boolean); 
  65.    --  Retrieve a symbol pointer from `module'. 
  66.    --  Success is set to True on success. 
  67.  
  68.    function Module_Name (Module : G_Module) return String; 
  69.    --  Retrieve the file name from an existing module 
  70.  
  71.    function Module_Build_Path 
  72.      (Directory   : String; 
  73.       Module_Name : String) return String; 
  74.    --  Build the actual file name containing a module. 
  75.    --  `directory' is the directory where the module file is supposed to be, or 
  76.    --  the null string in which case it should either be in the current 
  77.    --  directory or, on some operating systems, in some standard place, for 
  78.    --  instance on the PATH. Hence, to be absolutely sure to get the correct 
  79.    --  module, always pass in a directory. The file name consists of the 
  80.    --  directory, if supplied, and `module_name' suitably decorated accoring to 
  81.    --  the operating system's conventions (for instance lib*.so or *.dll). 
  82.    -- 
  83.    --  No checks are made that the file exists, or is of correct type. 
  84.  
  85. private 
  86.    pragma Import (C, Module_Make_Resident, "g_module_make_resident"); 
  87. end Glib.Module;