[Lazarus] Library, Threads and Gui
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Tue Jun 5 11:57:48 CEST 2012
Mattias Gaertner wrote:
> On Tue, 05 Jun 2012 10:18:04 +0930
> SteveG <steveg at nevets.com.au> wrote:
>> I understand that the gui system is non-reentrant, and therefore should
>> not be accessed by any thread but the main one.
>> I am using cmem as my memory manager for both my app and library (if
>> thats relevant),
> yes it is relevant.
> If you have two memory managers you can not exchange strings and
>> and it would appear that the entrant thread of the
>> library is the same as the main app ?
> What OS?
>> So.... is it safe to read / write to gui components (I have the control
>> addresses) from within the library (no new threads created) without
>> problems ?
> The "is" operator requires that the library uses the VMTs of the main
>> To summarise - can I rd/wr to form controls from within a cmem
>> controlled library using its main thread ?
> Yes, to some degree.
Please can I tack a related question onto this. If I have analogous
forms in a main program and shared library (.dll or .so), where the menu
structure in the main form is built up from what's in the library, can
the main program's menu call OnClick() events in the library safely?
What I'm hoping to do is use the library's form(s) purely for design
purposes, i.e. they're never displayed but instead their menu structure
is copied to the main program. Non-graphical backend functionality would
be in the library, and I've obviously got the choice of attempting to
control this using OnClick() etc. or by passing commands in strings to
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the Lazarus