[fpc-pascal] Moving callbackfunctions to class

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Thu Dec 30 18:09:49 CET 2010

On Thu, 30 Dec 2010, Jonas Maebe wrote:

> 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.

That kind of defeats the purpose, if you want to create a wrapper around the
window instance, which I understood to be the intention of Darius ?


More information about the fpc-pascal mailing list