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