Subject Re: [firebird-support] Writing UDF with Freepascal
Author Helen Borrie
At 05:46 AM 2/01/2008, you wrote:
>Hello everybody,
>
>I've tried to write with Freepascal a UDF for Firebird.
>
>library udf_upper;
>
>{$mode DELPHI}{$H+}
>{$PACKRECORDS C}
>
>uses
> Classes
> { you can add units after this };
>
>
>function UTF_UPPER(wert : PChar) : PChar; cdecl; export;
>begin
> wert1 := String(wert);
>//Some String operations
> result := PChar(wert1);
>end;
>
>exports
> UTF_UPPER name 'UTF_UPPER';
>
>begin
>
>end.
>
>I registered it in Firebird by using:
>
>DECLARE EXTERNAL FUNCTION WIDEUPPER
>CSTRING(32000)
>RETURNS CSTRING(32000) FREE_IT
>ENTRY_POINT 'UTF_UPPER' MODULE_NAME 'udf_upper';
>
>Everything works ok, but when I try to use the function in a
>SQL-Statement, it just says:
>
>ISC ERROR CODE:335544343
>
>ISC ERROR MESSAGE:
>invalid request BLR at offset 63
>function WIDEUPPER is not defined
>module name or entrypoint could not be found
>
>I absolutely don't know why...
>
>Can somebody please help me?

The UDF exports
UTF_UPPER name 'UTF_UPPER';

You're declaring

ENTRY_POINT 'UTF_UPPER' MODULE_NAME 'udf_upper';

./heLen