To register user-defined purpose functions with the database server, issue a CREATE FUNCTION statement for each one.
By convention, you package access-method functions in a DataBlade module. Install the software in $INFORMIXDIR/extend/DataBlade_name on UNIX or %INFORMIXDIR%\extend\DataBlade_name on Windows.
For example, assume you create an open_virtual function that has a table descriptor as its only argument, as the following declaration shows:
mi_integer open_virtual(MI_AM_TAB_DESC *)
Because the database server always passes descriptors by reference as generic pointers to the access method, you register the purpose functions with an argument of type pointer for each descriptor. The following example registers the open_virtual() function on a UNIX system. The path suggests that the function belongs to a DataBlade module named amBlade.
CREATE FUNCTION open_virtual(pointer)
RETURNING integer
EXTERNAL NAME
'$INFORMIXDIR/extend/amBlade/my_virtual.bld(open_virtual)'
LANGUAGE C
For the complete syntax of the CREATE FUNCTION statement, refer to the IBM Informix: Guide to SQL Syntax. For information about privileges, refer to the GRANT statement in the IBM Informix: Guide to SQL Syntax.