[fpc-pascal] Moving callbackfunctions to class

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Dec 30 18:10:38 CET 2010

On 30 Dec 2010, at 17:34, Darius Blaszyk wrote:

> As these functions are needed per window, I would like to encapsulate each window in a class something like:
> TMyGLutWindow = class
>  private
>    procedure MyDisplayFunc; cdecl;
>  public
>    constructor Create;
> end;
> In the constructor I would like to set the displayfunction. But doing this I get the error:
> Error: Incompatible types: got "<procedure variable type of procedure of object;CDecl>" expected "<procedure variable type of procedure;CDecl>"
> Though I understand the error, I do not know if there is a way to circumvent this?

Maybe with a static class method? (they may require svn trunk to work though) You won't be able to access any fields from that one, of course.


More information about the fpc-pascal mailing list