13.1 Interfacing to C

Interfacing to C with GNAT can use one of two approaches:

Pragma Convention C may be applied to Ada types, but mostly has no effect, since this is the default. The following table shows the correspondence between Ada scalar types and the corresponding C types.

Ada TypeC Type
Integerint
Short_Integershort
Short_Short_Integersigned char
Long_Integerlong
Long_Long_Integerlong long
Short_Floatfloat
Floatfloat
Long_Floatdouble
Long_Long_FloatThis is the longest floating-point type supported by the hardware.

Additionally, there are the following general correspondences between Ada and C types: