This section describes requirements for User-Defined Functions, including supported languages and implementation.
The server must be able to find the library that contains your UDF, load the library into memory, call your UDF, and pass appropriate parameters to the UDF. Because of this, each UDF must meet the following requirements:
The UDF must be written in C or C++. The function names that are externally visible must use C naming conventions. C++ name mangling will prevent the code from being accessible.
The UDF implementation must be compiled into a shared library (.so or .dll) for the specific platform. That library can contain one or more user-defined functions.
Before the server can call a function, the server must be told the name of the library, the names of the UDFs in that library, and the data types of the parameters passed to each function. This information must be stored in an XML file that the server reads when it starts up. The format of this file is described in UDFs: XML Signatures.
The UDF must declare appropriate C-language data types that match the CCL data types of the parameters. For example, if the server calls the UDF with a value of type TIMESTAMP, the corresponding C-language variable must be of type C8Timestamp.
To write a UDF, you must create the following files:
A C-language file that contains your UDF and code to pack and unpack values that are stored in a context parameter. (This is described in more detail in Accessing Parameter Values.)
An XML file with the library name, function name, and parameter types.
Each of these files is described in this document.