Gtkada.C

Entities

Description

----------- Arrays -- ----------- The following functions ease bindings: when a C function returns an array or a pointer to an array, it returns a C array, ie which doesn't contain bounds. The size of the array is generally reported separately. The following definitions are suitable for use internally in the binding, but should not, when possible, be made visble to the user, since they don't behave like usual Ada arrays ('Last is irrelevant for instance).

For instance, if a C function has the following profile: gint* get_sizes (GtkIconTheme* theme); -- 0 terminated array when the binding is: function Internal (Theme) return Unbounded_Gint_Array_Access; and you need to compute for yourself the number of elements, and return a Glib.Gint_Array to the user.

If the C function has the following profile: gboolean get_attach_points (theme, GdkPoint** p, gint* n); then the binding is: function Internal (Theme : System.Address; Points : out Unbounded_Points_Array_Access; N : access Gint) return Gboolean; and you do the following: R : aliased Unbounded_Points_Array_Access; N : aliased Gint; Tmp : constant Gboolean := Internal (.., R'Unchecked_Access, N'Unchecked_Access); Result : Gdk_Points_Array (1 .. Natural (N)) := To_Gint_Array (R, Natural (N)); Free (R); return Result;