[fpc-pascal] Moving callbackfunctions to class

José Mejuto joshyfun at gmail.com
Fri Dec 31 17:42:42 CET 2010

Hello FPC-Pascal,

Friday, December 31, 2010, 2:03:27 PM, you wrote:

>> 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 :-?
DB> Unfortunately I need a platform independent method to handle
DB> this. So assembler is not really the way I want to go, unless it
DB> proves to be the only way.

After thinking a bit in the problem, you do not need assembler, but
you will need to write a wrapper for each callback call that setup
some kind of trampoline different for each callback.

Just for the experiment I'll try to mockup something that should work
( if I'm able :) ).

Best regards,

More information about the fpc-pascal mailing list