[Lazarus] nonlcl basic issue: is codetools LCL dependent?

Sven Barth pascaldragon at googlemail.com
Thu Jun 26 14:41:21 CEST 2014


Am 26.06.2014 12:36 schrieb "Michael Schnell" <mschnell at lumino.de>:
>
> On 06/25/2014 09:57 PM, Sven Barth wrote:
>>
>>
>> If you rely on the new TThread functionality you'd need to at least put
in guards against compiling with a pre-2.7.1 compiler.
>
> Can I do this by a {$ifdef ... } ?

{$IF FPC_FULLVERSION < 20701}
{$MESSAGE fatal 'You need at least FPC 2.7.1'}
{$ENDIF}

Untested. I haven't used $message in quite some time...

>
>
>> Better would be to write the code in a way that it works with 2.6.x as
well.
>
>
> I can try to do this:
>
> -  TThread.CurrentThread:
> This is only necessary for perfectly calling TThread.Queue, as same is
not a class functions (even though I suppose it could be)

Did you even look at the interface of TThread? There's a protected instance
function that calls a public class function with Self as first parameter.
If you use the second one and pass Nil as first parameter it automatically
uses the current thread.

>
> -  TThread.Queue,:
> I use this to implement Application.QueuAsyncCall.
> I can try to do the (supposedly minimal) code that in TThread.Queue
forwards the procedure of object to the Event queue, native in the
implementation of my TApplication class.

A little sidenote: the current implementation immediately executes events
queued by the main thread. This is Delphi compatible.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140626/1583542d/attachment-0003.html>


More information about the Lazarus mailing list