Each user-defined function (UDF) must meet several requirements.
The server must be able to find the library that contains your UDF. To facilitate this, load the library into memory, call your UDF, and pass the appropriate parameters to the UDF. Each UDF must meet several requirements:
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.
The UDF must be written in C or C++. The externally visible function names must use C naming conventions. Improper C++ naming will make the code inaccessible.
The UDF implementation must be compiled into a shared library (also called a Dynamic Link Library) for its specific platform. That library may contain one or more user-defined functions.
Some of these requirements may be modified in future versions of the product as more Sybase CEP SDKs are enhanced to support UDFs.
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 later.)
An XML file with the library name, function name, and parameter types.
Each of these files is described later in this document.