[fpc-pascal] Moving callbackfunctions to class
José Mejuto
joshyfun at gmail.com
Fri Dec 31 13:53:22 CET 2010
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 :-?
--
Best regards,
José
More information about the fpc-pascal
mailing list