[fpc-pascal] Is there a StringRefCount() equivalence?

Bihar Anwar bihar_anwar at rocketmail.com
Thu Apr 29 19:30:48 CEST 2010


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



      



More information about the fpc-pascal mailing list