diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2024-10-07 19:51:28 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2024-10-07 19:51:28 +1300 |
commit | 07e7b817c59c3dce263bfb89b51248316c343f0e (patch) | |
tree | 5ebe3664317c69f267ad57e4c676ba3f40ac5c6c /src/portaudio.ads | |
parent | 87b89d768d367a475bb553de295ac867909c28c9 (diff) |
Now using Integer_Address for C interface
Diffstat (limited to 'src/portaudio.ads')
-rw-r--r-- | src/portaudio.ads | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/portaudio.ads b/src/portaudio.ads index 2744047..282f994 100644 --- a/src/portaudio.ads +++ b/src/portaudio.ads @@ -11,7 +11,7 @@ private with Ada.Finalization, Interfaces.C.Strings, - System; + System.Storage_Elements; package Portaudio is @@ -190,9 +190,27 @@ package Portaudio is private + package Storage renames System.Storage_Elements; + use type Interfaces.C.size_t, Storage.Integer_Address; + + + Null_Pointer : constant Storage.Integer_Address := Storage.To_Integer (System.Null_Address); + + pragma Linker_Options ("-lportaudio"); + function c_pointer_size + return Interfaces.C.size_t; + pragma Import (C, c_pointer_size, "c_pointer_size"); + + -- If this fails then we are on an architecture that for whatever reason + -- has significant problems interfacing between C and Ada + pragma Assert + (c_pointer_size * Interfaces.C.CHAR_BIT = Storage.Integer_Address'Size, + "Size of C void pointers and size of Ada address values do not match"); + + type C_Version_Info is record My_Major : Interfaces.C.int; My_Minor : Interfaces.C.int; |