Subject Re: [firebird-support] Re: UDF and Linux, Need help....
Author Trond
On Fri, 13 Feb 2004 14:17:33 +0100, Ivan Prenosil
<Ivan.Prenosil@...> wrote:

>> But, the problem is still there.
>
> Do you mean the problem is still there even after correcting
> memory allocation in the way I told you in previous mail ?
>
>> function kidfromint(var V1, prefix,lengde : integer) : PAnsichar;
>> cdecl; export;
>> var
>> formatertNR : string;
>> begin
>> formatertNR := trim(inttostr(V1));
>> ...
>> Result := PAnsichar(formatertNR);
>> end;
>
> You are returning address of long string associated with local
> variable, that is freed after the function ends, i.e. _before_ Firbird
> reads its value.
>
> Ivan
>
No, I'm sorry, but I don't know how to do this. I can see that this is a
problem.
I'v struggled with this before (Returning a Pchar). what is it that I am
supposed to
allocate, the result variable?. A small examle will be greatly apriciated.

Or maybe I try to write a StoredProc instead, but it has worked for over a
year on windows servers.

Thank you for your patient.

Trond.

>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>



--
Trond