[fpc-pascal] Moving callbackfunctions to class

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Fri Dec 31 14:03:27 CET 2010


On Dec 31, 2010, at 1:53 PM, José Mejuto wrote:

> Hello FPC-Pascal,
> 
> Friday, December 31, 2010, 1:53:31 AM, you wrote:
> 
> DB> I installed 2.5.1 just to test if it was possible to use
> DB> static class methods or not. Apparently not so it seems. It was a
> DB> good try, but it failed. Thanks anyway for the help and
> DB> explanation Jonas.
> DB> It seems that GLut however offers a backdoor as was pointed
> DB> out by honza. By using glutGetWindow, I can simply check in the
> DB> main callback function which window paint method to handle. Thanks
> DB> for the tip!
> 
> You can create the same effect using trampolines, but unless fpc has a
> way to create trampolines you will be forced to use assembler (I was
> using them in assembler in the past with Delphi). With this
> trampolines you create a different callback pointer for each callback
> and in this callback the Self pointer is "hardcoded" and the "class
> callback" called, which creates the effect that the callback is
> connected with the class.
> 
> I do not know if all platforms support code execution in data memory :-?

Unfortunately I need a platform independent method to handle this. So assembler is not really the way I want to go, unless it proves to be the only way.

Regards, Darius


More information about the fpc-pascal mailing list