On Tue, 15 Feb 2022, James Richters wrote:

Thanks for the elegant solution Michael, but I'm having some issues 
implementing it.

I'm getting:

pastep.pas(28651,10) Warning: Function result does not seem to be set

28650  // Custom compare function
28651  function CompareValues(List: TStringList; Index1, Index2: Integer): 
Integer;
28652
28653  begin
28654     
Result:=CompareText(List.ValueFromIndex[Index1],List.ValueFromIndex[Index2])
28655  end;

pastep.pas(28797,65) Error: Incompatible type for arg no. 1: Got "Pointer", expected 
"<procedure variable type of function(TStringList;LongInt;LongInt):LongInt;Register>"

28797   AllLogLastRunStringList.CustomSort(@CompareValues);

The unit I'm putting this in has:
Unit PAStep;
{$Mode TP}{$I-}

Ehmmm.. TStringList is not supposed to be used in mode TP, and Result likewise should not be
available IIRC...


{$modeswitch exceptions}
{$R+}

I can fix the first error with:
28654   
CompareValues:=CompareText(List.ValueFromIndex[Index1],List.ValueFromIndex[Index2])
{$Mode TP} doesn't like using 'result'

But I have no idea how I could fix the second error.  Any ideas?

Try to remove the @

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to