Subject Re: [ib-support] Using a UDF
Author Helen Borrie
At 06:05 AM 22-04-02 -0700, you wrote:
>Good Morning!
>
> Previously, I had asked about appending a CR/LF to
>a string. Helen Borrie answered that I need to use the
>Character() function of FreeUDFlib.
>
> Now I am trying to do that. I have created a UDF in
>my db (Ascii_To_Char) that takes an Integer and
>returns the character as Char(1). I told it that the
>library is FreeUFDLib (and have a copy of it in the
>bin folder) and that the entry point is Character. The
>new UDF compiled.
>
> When I try to use Ascii_To_Char in my sp, the
>compiler complains that Ascii_To_Char is undefined.
>
> This is the same kind of problem I have had before
>when trying to use a UDF.
>
> Can someone tell me which magic incantations I have
>to use to get a UDF to work?

There's a tradition with UDF libraries to ship a file (.sql) with the lib,
containing all the declarations. Look for ext_funcs.sql in the FreeUDFLib kit.

fyi, from ext_funcs.sql (with the ".dll" extension edited out, you're not
supposed to include it):

/* String functions */
declare external function f_Character
integer
returns cstring(2) /* free_it */
entry_point 'Character' module_name 'FreeUDFLib';

declare external function f_CRLF
returns cstring(3) /* free_it */
entry_point 'CRLF' module_name 'FreeUDFLib;

btw, locate the dll in your ..\udf directory.

cheers,
Helen

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________