Example of a C User-Defined Function

The next example registers an external function named equal( ) that takes two point data type values as arguments. In this example, point is an opaque data type that specifies the x and y coordinates of a two-dimensional point.
CREATE FUNCTION equal( a point, b point ) RETURNING BOOLEAN;
   EXTERNAL NAME "/usr/lib/point/lib/libbtype1.so(point1_equal)"
   LANGUAGE C
END FUNCTION;

The function returns a single value of type BOOLEAN. The external name specifies the path to the C shared-object file where the object code of the function is stored. The external name indicates that the library contains another function, point1_equal( ), which is invoked while equal( ) executes.