Delphi has StringRefCount() function (I'm not aware since what version it was 
introduced). I just curious, is there a function equivalent to it in FPC? 
Currently, I just steal a portion of code from System unit:

type
  PAnsiRec = ^TAnsiRec;
  TAnsiRec = packed record
    Ref,
    Len   : SizeInt;
    First : Char;
  end;

const
  FirstOff   = SizeOf(TAnsiRec) - 1;

var
  S: ansistring;
  RefCount: SizeInt;

RefCount := PAnsiRec(S - FirstOff)^.Ref



      
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to