Fixed-length opaque data type

If the C structure that holds your opaque type is always the same size, regardless of the data it holds, you can declare the opaque type as a fixed-length opaque type.

You tell the database server that an opaque type is fixed length when you register the opaque type. In the CREATE OPAQUE TYPE statement, you must include the INTERNALLENGTH modifier to specify the fixed size of the C structure. The database server stores the value of the INTERNALLENGTH modifier in the length column of the sysxtdtypes system catalog table.

The circle_t C structure (which Internal representation of the circle opaque data type defines) is a fixed-length structure because all of its member fields have a constant size. Therefore, the following CREATE OPAQUE TYPE statement registers a fixed-length opaque type named circle for the circle_t structure:
CREATE OPAQUE TYPE circle (INTERNALLENGTH = 24);
The size of a fixed-length opaque data type must match the value that the C-language sizeof directive returns for the C structure. On most compilers, the sizeof directive performs cast promotion to the nearest four-byte size to ensure that the pointer match on arrays of structures works correctly. However, you do not need to round up for the size of a fixed-length opaque data type. Instead you can specify alignment for the opaque data type with the ALIGNMENT modifier. For more information, see Specify the memory alignment of an opaque type.
Important: The routine manager does perform cast promotion on argument values smaller than the size of the MI_DATUM data type when it pushes routine arguments onto the stack. On some platforms, small values can create problems with pointer matching. For more information, see Push arguments onto the thread stack.

The size of the fixed-length opaque type determines the passing mechanism for the opaque type. For more information, see Determine the passing mechanism for an opaque type.

You can obtain information about support functions for the circle fixed-length opaque type in Write opaque-type support functions. The following table lists the circle support functions that this section declares.
Support function for circle opaque type Where to find declaration
Input Input support function for circle opaque type
Output Output support function for circle opaque type
Receive Receive support function for circle opaque type
Send Send Support Function for circle Opaque Type
Import Import support function for circle opaque type
Export Export support function for circle opaque type
Importbin Importbin Support Function for circle Opaque Type
Exportbin Exportbin support function for circle opaque type