Subject | Re: [firebird-support] udf firebird delphi |
---|---|
Author | Martijn Tonies |
Post date | 2004-03-31T11:55:58Z |
Hi Marc,
I'm not an expert on writing UDFs at all... but:
a PChar in Delphi? According to the Help:
function Length(S): Integer;
S is a string- or array-valued expression.
FREE_IT?
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com
I'm not an expert on writing UDFs at all... but:
> i created this function:What's the declaration you're using? cdecl?
>
> function MixStr(Str:PChar):PChar;
> varWhat does Length(Str) return? What is the length of
> i, j : Integer;
> c1 : Char;
> begin
> if (Str = nil) then
> result := nil
> else
> begin
> for i:=Length(Str) downto 1 do
a PChar in Delphi? According to the Help:
function Length(S): Integer;
S is a string- or array-valued expression.
> beginAs you're not grabbing any memory, should you use
> j:=Random(i)+1;
> c1:=Str[i];
> Str[i]:=Str[j];
> Str[j]:=c1;
> end;
> result := Str;
> end;
> end;
>
> under firebirdi declared:
>
> Declare external function f_MixStr cstring(64)
> returns cstring(64) free_it
> entry_point 'MixStr' module_name 'brudflib2.dll';
FREE_IT?
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com