Next: RM B 4 95-98 Interfacing with COBOL, Previous: RM B 2 12-13 Package Interfaces, Up: Implementation Advice
"An implementation should support the following interface correspondences between Ada and C."
Followed.
"An Ada procedure corresponds to a void-returning C function."
Followed.
"An Ada function corresponds to a non-void C function."
Followed.
"An Ada in scalar parameter is passed as a scalar argument to a C function."
Followed.
"An Ada in parameter of an access-to-object type with designated type T is passed as a
t*
argument to a C function, wheret
is the C type corresponding to the Ada type T."
Followed.
"An Ada access T parameter, or an Ada out or in out parameter of an elementary type T, is passed as a
t*
argument to a C function, wheret
is the C type corresponding to the Ada type T. In the case of an elementary out or in out parameter, a pointer to a temporary copy is used to preserve by-copy semantics."
Followed.
"An Ada parameter of a record type T, of any mode, is passed as a
t*
argument to a C function, wheret
is the C structure corresponding to the Ada type T."
Followed. This convention may be overridden by the use of the C_Pass_By_Copy pragma, or Convention, or by explicitly specifying the mechanism for a given call using an extended import or export pragma.
"An Ada parameter of an array type with component type T, of any mode, is passed as a
t*
argument to a C function, wheret
is the C type corresponding to the Ada type T."
Followed.
"An Ada parameter of an access-to-subprogram type is passed as a pointer to a C function whose prototype corresponds to the designated subprogram's specification."
Followed.