Start a conversation

The interface of functions with Ada String parameters is changed and we had trouble understanding the body of the operation Procedure Printf(Msg: String) was converted to extern void Printf(const Character * const Msg, int32 const * Msg__dope). Explain.

In Ada, every unconstrained array also carries information on its array bounds. This is traditionally called the array “dope.” So when an array is passed, we also need to pass information on the low and high bound of the array, which is represented as a 2-word array of integers in the generated C code. Note that you can gain some control over this by using pragma Export or pragma Convention in the original Ada code. For example, by specifying the Convention is “C”, it will only pass the address of the first element of the array, and presume the called routine has some other way of knowing the high bound (e.g. a null terminator or a separate parameter).

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. MapuSoft

  2. Posted
  3. Updated

Comments