Subject Re: [firebird-support] UDF and Linux, Need help....
Author Trond
I'm Not.. (But I am about to destroy the reputation that I know what I'm
doing :) )
One of the Functions in the Dll looks like this:
------
function kidfromint(var V1, prefix,lengde : integer) : PAnsichar; cdecl;
export;
var
formatertNR : string;
pre : char;
begin
formatertNR := trim(inttostr(V1));
Try
if lengde-1 > length(formatertNR) then
begin
while length(formatertNR) < lengde-1 do formatertNR :=
'0'+formatertNR; //LeftPadd 0 til lengde
if prefix > 0 then pre := (inttostr(prefix)[1]);
begin
formatertNR[1] := pre;
end;
end;
formatertNR := formatertNR
+trim(string(kontrollsifferfromstr(PAnsichar(formatertNR))));
Result := PAnsichar(formatertNR);
except
Result := '';
end;
end;
------
If this helps. Is it just luck that it works on a Window Server ?.


On Thu, 12 Feb 2004 14:06:28 +0100, Ivan Prenosil
<Ivan.Prenosil@...> wrote:

> How are you allocating and releasing memory for return values of your
> UDFs ?
> You shoud use ib_util_malloc() function (from ib_util library),
> and free it using FREE_IT keyword in UDF declaration:
>
>> DECLARE EXTERNAL FUNCTION KIDFROMINT
>> INTEGER,
>> RETURNS CSTRING(25) FREE_IT
>> ENTRY_POINT 'kidfromint' MODULE_NAME 'flexisoftudf'
>
> Ivan
>
>
> ----- Original Message -----
> From: "Trond" <trodamm@...>
> To: <firebird-support@yahoogroups.com>
> Sent: Thursday, February 12, 2004 12:39 PM
> Subject: [firebird-support] UDF and Linux, Need help....
>
>
>> I have some selfmade UDF's that is working fine on a Windows server (XP,
>> FB1.5 RC4-RC9).
>> The UDF's is written in Delphi(on Windows) and Kylix(on Linux).
>> As soon as i move the database to Linux (RedHat 9.x, FB 1.5 CC RC8), the
>> server dies instantly (connection is broken)when calling the UDF. No
>> entry
>> in
>> Firebird.log. The same thing happens either the call is coming from my
>> application or from ISQL. HOWEVER If I connect thru IBexpert, and run
>> the
>> SQL from
>> the SQL Editor it works fine!!.
>> What is going on ? I have no real experience with UDF's and Linux, so
>> this
>> might be trivial, but I really need some help on this.
>>
>> The UDF's are typically decleared like this:
>>
>> function kidfromint(var V1, prefix,lengde : integer) : PAnsichar; cdecl;
>> export;
>> ...
>>
>>
>> function kidfromstr(V1 : PAnsichar ; var prefix,lengde : integer) :
>> PAnsichar; cdecl; export;
>> ...
>>
>> DECLARE EXTERNAL FUNCTION KIDFROMINT
>> INTEGER,
>> INTEGER,
>> INTEGER
>> RETURNS CSTRING(25)
>> ENTRY_POINT 'kidfromint' MODULE_NAME 'flexisoftudf'
>>
>> DECLARE EXTERNAL FUNCTION KIDFROMSTR
>> CSTRING(25),
>> INTEGER,
>> INTEGER
>> RETURNS CSTRING(25)
>> ENTRY_POINT 'kidfromstr' MODULE_NAME 'flexisoftudf'
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>



--
Trond