Pass-by-value parameters
When an argument has a data type that can fit into an MI_DATUM structure, the routine manager passes the argument by value. For these pass-by-value arguments, you declare a parameter as the actual parameter data type in the C-function declaration.
Table 1 lists data types for arguments that you can pass by value.
The following code fragment shows the bigger_int() UDR,
which compares two mi_integer values. Because the routine manager
passes mi_integer values by value, the UDR declares the two
parameters with the mi_integer data type, not as pointers to mi_integer.
Figure 1. Passing arguments
by value
mi_integer bigger_int(left, right)
mi_integer left, right;
{
if ( left > right )
return(left);
else
return(right);
}
Any C-language code that calls bigger_int() must also pass
the mi_integer values by value, as in the following sample
call:
mi_integer int1, int2, result;
...
int1 = 6;
in2 = 8;
result = bigger_int(int1, int2);