On Fri, 31 Dec 2010, Darius Blaszyk wrote:
On Dec 31, 2010, at 10:43 AM, Paul Ishenin wrote:
31.12.2010 7:53, Darius Blaszyk wrote:
I installed 2.5.1 just to test if it was possible to use static class methods
or not. Apparently not so it seems. It was a good try, but it failed. Thanks
anyway for the help and explanation Jonas.
Try {$mode delphi}.
Thanks for the tip Paul. Unfortunately it did not help. See for the results
below.
Delphi mode:
class -> Error: Incompatible types: got "class TfpgGLApplication.CDisplayFunc; CDecl;"
expected "<procedure variable type of procedure;CDecl>"
static -> Error: Incompatible types: got "class TfpgGLApplication.CDisplayFunc; CDecl; Static;"
expected "<procedure variable type of procedure;CDecl>"
ObjFPC mode:
class -> Error: Incompatible types: got "<class method type of procedure of object;CDecl>"
expected "<procedure variable type of procedure;CDecl>"
static -> Error: Incompatible types: got "<class method type of procedure of object;CDecl>"
expected "<procedure variable type of procedure;CDecl>"
Even if they worked, it would do you no good: you would have no access to instance fields,
or the VMT, since neither is passed when glut calls your callback:
- Class methods need 'self' (it will contain the VMT),
and cannot access fields of an instance (since there is none to work with)
- Static methods do not need self, but they also cannot access fields of a
class instance.
Static methods are like regular procedures, but their name just contains a
dot (.) character.
Conclusion: You can just as well use a regular procedure; the rest is a waste
of your time.
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal