3 with Interfaces
.C
; use Interfaces
.C
;
4 with Interfaces
.C
.Strings
; use Interfaces
.C
.Strings
;
5 with Ada
.Strings
.Unbounded
; use Ada
.Strings
.Unbounded
;
7 procedure memorytest
is
9 function malloc
(size
: size_t
) return chars_ptr
;
10 pragma Import
(C
, malloc
);
15 -- Allocate a string in C ...
17 -- ... and free it with the GNAT runtime
20 -- now allocate something completely unrelated and free it
22 A2
: Unbounded_String
:= To_Unbounded_String
("hello");