[Lazarus] Callback to method pointer

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Apr 27 15:44:35 CEST 2011



On Wed, 27 Apr 2011, Leonardo M. Ramé wrote:

> Hi, I'm using a shared library that allows me to pass a pointer to a
> function to act as a callback.
>
> To execute my function I use something like this:
>
> myDllFunction(param1, param2,..., paramn, @myCallback);
>
> myCallback is a regular procedure.
>
> What if I want to use a "procedure of object" (method) instead of a
> regular procedure?. Is this possible at all?.

In theory: maybe.

In practice : no. The VMTs will be different, and this will lead to all
kinds of problems. AnsiString properties will also require special handling.

I would not recommend it.

Michael.


More information about the Lazarus mailing list