Subject Re: UDF and Linux, Need help....
Author Svein Erling
Hei Trond!

I have no knowledge about neither UDFs nor Linux, but your code has
one flaw:

> if prefix > 0 then pre := (inttostr(prefix)[1]);
> begin
> formatertNR[1] := pre;
> end;

I think that should be

if prefix > 0 then
begin
pre := (inttostr(prefix)[1]);
formatertNR[1] := pre;
end;

since 'pre' otherwise would not get a value if prefix <= 0.

Also, I find
> formatertNR := trim(inttostr(V1));
to be a bit funny...

I hope this helps, even though I'd expect it to be something different
that is actually causing you problems,
Set
- I support Firebird, I am a FirebirdSQL Foundation member.
- Join today at http://www.firebirdsql.org/ff/foundation


--- In firebird-support@yahoogroups.com, Trond <trodamm@f...> wrote:
> 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 ?.