[fpc-pascal] Moving callbackfunctions to class

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


On 30 Dec 2010, at 18:27, Darius Blaszyk wrote:

> The intention is indeed to create a wrapper around the multiple callback functions that GLut provides and additionally add some other methods and properties.

That is impossible since the callback does not offer any way to pass the self pointer.

> I have tried using a class method (FPC 2.4.2) but not static class methods, although I don't really understand what you mean with "you won't be able to access any fields from that one". Afaik class methods have a self, right?

static class methods don't have a self pointer. And furthermore, the "self" parameter of class methods refers to the VMT of the class type, not to the "self" of an instance.

> That would suggest you can access any method or property of self from a class method?

Not from a static class method. A static class method is basically a regular procedure/function declared in the scope of a class.


Jonas


More information about the fpc-pascal mailing list