Example of Registering a C User-Defined Function

The following example registers an external C user-defined function named equal( ) in the database. This function takes two arguments of the type basetype1 and returns a single Boolean value. The external routine reference name specifies the path to the C shared library where the function object code is actually stored. This library contains a C function basetype1_equal( ), which is invoked during execution of the equal( ) function.
CREATE FUNCTION equal ( arg1 basetype1, arg2 basetype1)
   RETURNING BOOLEAN;
   EXTERNAL NAME
      "/usr/lib/basetype1/lib/libbtype1.so(basetype1_equal)"
   LANGUAGE C
END FUNCTION;