sdlada_2.5.20_cd53c280/src/sdl-libraries.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--------------------------------------------------------------------------------------------------------------------
--  This source code is subject to the Zlib license, see the LICENCE file in the root of this directory.
--------------------------------------------------------------------------------------------------------------------
--  SDL.Libraries
--
--  Mechanism for accessing shared objects (libraries).
--------------------------------------------------------------------------------------------------------------------
with Ada.Finalization;

package SDL.Libraries is
   pragma Preelaborate;

   Library_Error : exception;

   type Handles is new Ada.Finalization.Limited_Controlled with private;

   Null_Handle : constant Handles;

   procedure Load (Self : out Handles; Name : in String);
   procedure Unload (Self : in out Handles); -- with
   --     Static_Predicate => Handle /= Null_Handle;

   generic
      type Access_To_Sub_Program is private;

      Name : String;
   function Load_Sub_Program (From_Library : in Handles) return Access_To_Sub_Program;
private
   type Internal_Handle is null record with
     Convention => C;

   type Internal_Handle_Access is access all Internal_Handle with
     Convention => C;

   type Handles is new Ada.Finalization.Limited_Controlled with
      record
         Internal : Internal_Handle_Access;
      end record;

   overriding
   procedure Finalize (Self : in out Handles);

   Null_Handle : constant Handles := (Ada.Finalization.Limited_Controlled with Internal => null);
end SDL.Libraries;