Return opaque-type values

When the routine manager returns opaque-type data from a C UDR, the way it handles the return value depends on the kind of opaque data type, as follows:
  • For fixed-length opaque types, the routine manager expects a pointer to the internal format of the opaque type, unless it was declared as pass by value.

    Therefore, a C UDR must declare its return value as a pointer to the internal format of the fixed-length opaque type. Only if the internal format can fit into an MI_DATUM structure can the C UDR pass the internal format by value.

  • For varying-length opaque types, the routine manager expects a pointer to an mi_bitvarying varying-length structure.

    Therefore, a C UDR must declare its return value as a pointer to an mi_bitvarying. To return a varying-length opaque type, the UDR must put the varying-length structure into the data portion of the mi_bitvarying structure and return a pointer to this mi_bitvarying structure.

Tip: A C UDR that accepts opaque-type data must also declare its parameters based on whether the opaque type is fixed-length or varying-length. For more information, see Handling opaque-type arguments.