A user-defined routine is typically defined in SQL and implemented in C.
When a user-defined routine is created in a database, the SQL routine and a C function are connected.
For example, the SQL function AddIntegers() is created with the following statement:
CREATE FUNCTION AddIntegers()
RETURNS integer
EXTERNAL NAME "$INFORMIXDIR/extend/AddInts.1.0/AddInts.bld(AddInts)"
LANGUAGE C;
When the SQL function AddIntegers() is called, the Informix server calls the C function AddInts() in the library AddInts.bld.
The SQL object model treats routines with the same name but different parameters as different routines. For example, the Informix server allows the following functions to exist in the same database and selects which one to call depending on the signature:
CREATE FUNCTION AddIntegers(integer) ...;
CREATE FUNCTION AddIntegers(float) ...;
In C, function names must be unique. Two C functions with different names are required to implement the two user-defined routines created in the preceding SQL statements, as follows:
CREATE FUNCTION AddIntegers(integer)
RETURNS integer
EXTERNAL NAME "$INFORMIXDIR/extend/AddInts.1.0/AddInts.bld(AddInts)"
LANGUAGE C;
...CREATE FUNCTION AddIntegers(float)
RETURNS float
EXTERNAL NAME "$INFORMIXDIR/extend/AddInts.1.0/AddInts.bld(AddInts1)"
LANGUAGE C;
In this example, the C function names are AddInts() and AddInts1().
For more information about routines and routine names, see Extending INFORMIX-Universal Server: User-Defined Routines.