[fpc-pascal] how to use procedure of object in C

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Mar 10 13:12:50 CET 2015


On 10 Mar 2015, at 10:40, OBones wrote:

> Xiangrong Fang wrote:
>> However, like in my first mail, if I define THandler a procedure of  
>> object, it makes easier to SetHandler(AMethod); but how can I use  
>> that "procedure of object" pointer in the so?
>>
> It works the same, cast the data you receive to a TMethod and call  
> the "code" member with the appropriate parameters. So, in the "C"  
> library do this:

Note that you have to make sure that you declare your "procedure of  
object" as "cdecl" in that case, and as a result you'll also have to  
declare all methods that you want to assign to this procvar as "cdecl".


Jonas



More information about the fpc-pascal mailing list