Declaring UDFs with FREE IT
Go Up to Declaring a UDF to a Database
InterBase FREE_IT keyword allows InterBase users to write thread-safe UDF functions without memory leaks.
Whenever a UDF returns a value by reference to dynamically allocated memory, you must declare it using the FREE_IT keyword in order to free the allocated memory.
- Note: You must not use
FREE_ITwith UDFs that return a pointer to static data, as in the “multi-process version” example on page 1-5.
The following code shows how to use this keyword:
DECLARE EXTERNAL FUNCTION lowers VARCHAR(256) RETURNS CSTRING(256) FREE_IT ENTRY POINT 'fn_lower' MODULE_NAME 'ib_udf'