<div dir="ltr"><div>Hello,</div><div><br></div><div>Consider the following sample:</div><div><br></div><div>=== begin code ===</div><div><br></div><div>type</div><div> TMyProc = procedure(ABytes: array of Byte; out AOutput: AnsiString);</div><div><br></div><div> TForm1 = class(TForm)</div><div> Button1: TButton;</div><div> procedure Button1Click(Sender: TObject);</div><div> procedure FormCreate(Sender: TObject);</div><div> private class var</div><div> FMyProc: TMyProc;</div><div> public</div><div> class constructor Create;</div><div> class procedure DoMyProc(ABytes: array of Byte; out AOutput: AnsiString); overload; static;</div><div> class property MyProc: TMyProc read FMyProc write FMyProc;</div><div> end;</div><div><br></div><div>var</div><div> Form1: TForm1;</div><div><br></div><div>implementation</div><div><br></div><div>{$R *.lfm}</div><div><br></div><div>procedure TForm1.Button1Click(Sender: TObject);</div><div>var</div><div> S: AnsiString;</div><div>begin</div><div> MyProc([65, 66, 67], S);</div><div> ShowMessage(string(S));</div><div>end;</div><div><br></div><div>class constructor TForm1.Create;</div><div>begin</div><div> FMyProc := @DoMyProc;</div><div>end;</div><div><br></div><div>class procedure TForm1.DoMyProc(ABytes: array of Byte; out AOutput: AnsiString);</div><div>begin</div><div> SetLength(AOutput, Length(ABytes));</div><div> Move(ABytes[0], AOutput[1], Length(ABytes));</div><div>end;</div><div><br></div><div>=== end code ===</div><div><br></div><div>The code above compiles fine in Delphi (tested in XE 7), but in FPC I got the following compiling error:</div><div><br></div><div>Unit1.pas(46,14) Error: Incompatible types: got "<class method type of procedure({Open} Array Of Byte;out AnsiString) of object;Register>" expected "<procedure variable type of procedure({Open} Array Of Byte;out AnsiString);Register>".</div><div><br></div><div>Is this a bug or I need to enable some switch?</div><div><br></div><div>Thank you!</div><div><div><br></div>-- <br><div class="gmail_signature">Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a></div>
</div></div>