| 1 |
with System; |
| 2 |
|
| 3 |
package Unc_Memops is |
| 4 |
pragma Elaborate_Body; |
| 5 |
|
| 6 |
type size_t is mod 2 ** Standard'Address_Size; |
| 7 |
subtype addr_t is System.Address; |
| 8 |
|
| 9 |
function Alloc (Size : size_t) return addr_t; |
| 10 |
procedure Free (Ptr : addr_t); |
| 11 |
function Realloc (Ptr : addr_t; Size : size_t) return addr_t; |
| 12 |
|
| 13 |
procedure Expect_Symetry (Status : Boolean); |
| 14 |
-- Whether we expect "free"s to match "alloc" return values in |
| 15 |
-- reverse order, like alloc->X, alloc->Y should be followed by |
| 16 |
-- free Y, free X. |
| 17 |
|
| 18 |
private |
| 19 |
|
| 20 |
-- Uncomment the exports below to really exercise the alternate versions. |
| 21 |
|
| 22 |
-- This only works when using an installed version of the tools which |
| 23 |
-- grabs the runtime library objects from an archive, hence doesn't force |
| 24 |
-- the inclusion of s-memory.o. |
| 25 |
|
| 26 |
-- pragma Export (C, Alloc, "__gnat_malloc"); |
| 27 |
-- pragma Export (C, Free, "__gnat_free"); |
| 28 |
-- pragma Export (C, Realloc, "__gnat_realloc"); |
| 29 |
|
| 30 |
end; |