[fpc-devel] platform directive

Marc Weustink marc.weustink at cuperus.nl
Mon Mar 13 12:20:53 CET 2006


Hi,

Question, does the platform derective onlyt work for properties ? It 
seems the you may add it to methods and procedures as well, but when 
accessing them no warning is issued. On FPC 2.0.2 I only get an warning 
if I access property A.
I couldn't find documentation on this either.

Marc

program platformcheck;
{$mode objfpc}{$H+}

uses
   Classes;

type
   TMyObj = class
   private
     FA: Integer; //platform;
   public
     function GetA: Integer; platform;
     procedure SetA(AValue: Integer); platform;
     property A: Integer read GetA write SetA;  platform;
   end;

function TMyObj.GetA: Integer;
begin
   Result := FA;
end;

procedure TMyObj.SetA(AValue:Integer);
begin
   FA := AValue;
end;

procedure B; platform;
begin
end;

var
   Obj: TMyObj;

begin
   Obj := TMyObj.Create;
   Obj.A := 1;
   Obj.SetA(2);
   Obj.FA := 3;
   WriteLN(Obj.GetA);
   Obj.Free;
   B;
end.



More information about the fpc-devel mailing list