You create a shared-object file to hold the compiled UDRs. This file resides in a directory on the server computer. Each UDR must have a unique name within the shared-object file.
On UNIX or Linux a shared-object file is often called a shared library. On Solaris systems, shared-object files have the .so file extension.
On Windows a shared-object file is called a dynamic link library (DLL). DLLs usually have the .dll file extension.
When the database server executes an SQL statement that contains a UDR, it loads in memory the shared-object file in which the UDR executable code resides. It determines which shared-object file to load from the externalname column of the row in the sysprocedures system catalog table that describes the UDR. The CREATE FUNCTION or CREATE PROCEDURE statement creates a row for a UDR in sysprocedures when it registers the UDR.
You can put C functions for related UDRs into the same shared-object file. However, the name of each C function must be unique within the shared-object file.
The shared-object file must not have permissions that allow any user other than user informix to have write permission.
The shared-object file does not have to exist before you register its path with CREATE FUNCTION or CREATE PROCEDURE. However, at UDR runtime, the paths of the shared-object file and the registered UDR must match for the database server to locate the UDR.
/compilers/bin/cc -K abs.o -o abs.so ld -G abs.o -o abs.so
# ls -ld /usr/code drwxr-xr-x 12 informix devel 2560 Feb 25 05:27 /usr/code # chmod 775 /usr/code/abs.so drwxrwxr-x 12 informix devel 2560 Feb 25 05:27 /usr/code
link /DLL /OUT:abs.dll /DEF:abs.def abs.obj d:\informix\lib\SAPI.LIB
The preceding command uses the IBM Informix software installed on the d: drive in a directory named informix.
attrib