[fpc-pascal] Moving callbackfunctions to class

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Thu Dec 30 17:34:40 CET 2010


Hi,

GLut defines callback functions, one of them is the display function, which is defined as:

TGlutVoidCallback = procedure; cdecl;

This is set by calling glutDisplayFunc(@MyDisplayFunc); 

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?

Regards, Darius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20101230/fd5fef3f/attachment.html>


More information about the fpc-pascal mailing list