Subject Problems with UDF and Linux
Author Fabrício Fadel Kammer
Hi all,

I did a UDF in Delphi and it's work fine in my Windows servers.

Than I compiled it in kylix with sucsses and put in the directory
/opt/interbase/UDF/abcs_udf.so on my linux server but I can't do the UDF
work.
Every time that I run a SQL using the UDF in the IBExpert I lose the
connection with the firebird server.
If I execute the select using the udf in the isql of my linux server I
receive the message: "Statement failed, SQLCODE = -902 Error reading
data from the connection.".

Why do it occours? Why does the UDF works fine in the windows server and
it doesn't work on linux server?

See the Object Pascal code of my function:

function udf_FormatFloat(var Valor: Double; FormStr: PChar; Pontos:
PChar): PChar; cdecl; export;
var
ResAux: string;
begin
ResAux := pchar( FormatFloat( FormStr, Valor ) );
if Pontos = 'N' then
begin
ResAux := AnsiReplaceStr( ResAux, '.', '' );
ResAux := AnsiReplaceStr( ResAux, ',', '' );
end;
Result := PChar( ResAux );
end;

And the SQL declaration of the UDF:

DECLARE EXTERNAL FUNCTION UDF_FORMATFLOAT
DOUBLE PRECISION,
CSTRING(20),
CHAR(1)
RETURNS CSTRING(50) FREE_IT
ENTRY_POINT 'udf_FormatFloat' MODULE_NAME 'abcs_udf'