[Lazarus] Callback and Threads problem

Sergei Gorelkin sergei_gorelkin at mail.ru
Fri Apr 6 15:59:38 CEST 2012


06.04.2012 16:31, Leonardo M. Ramé пишет:
> I have a similar problem to this:
>
> http://www.lazarus.freepascal.org/index.php?topic=10571.0
>
> My main program launches a thread, that loads a shared library, then
> execute a function who receives as a parameter a pointer to a callback
> function and an instance of the caller, as this:
>
> procedure TMythread.execute;
> begin
>    ...
>    // external function
>    runcode(@MyCallBack, @Self);
>    ...
> end;
>
You should pass 'Self' here, not '@Self'. The latter would be correct for TP-style objects, but 
TThread descendant is a class.

Regards,
Sergei




More information about the Lazarus mailing list