[Lazarus] Multiple LCL instances
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Jun 11 11:36:43 CEST 2010
On Fri, 11 Jun 2010 10:23:36 +0200
Michael Schnell <mschnell at lumino.de> wrote:
> There were several discussions, that when doing a DLL or .so with
> Lazarus and using same with a Lazarus project, it's an issue that the
> DLL will create it's own LCL "application" instance and thus you can't
> easily do "normal" GUI stuff in the DLL/.so. I seem to remember that
> there is a possible workaround by passing the main program's
> application's pointer to the called instance (or something like that).
> With Delphi you can use a "runtime package" that seems to do this
> automatically rather than a DLL.
>
> Now I'm interested in the contrary:
>
> Is there a decent way to create multiple instances of the LCL
> "application" and/or GUI interface to allow for an application that has
> multiple independent "main forms" (each with it's own main thread), i.e.
> something like multiple applications that share a common memory space
> (and heap management). The goal is to create a complex application that
> in one window needs to show rather complex GUI informations that come in
> from some threads and are passed towards the main thread and thus
> permanently generate heavy LCL activity and on another window some user
> interaction should be handled in a timely way (rather than being blocked
> by activity done in the other Window). Starting from some level of
> complexity, simply doing "Application.ProcessMessages" is not enough any
> more as (1) this introduces additional overhead slowing down things even
> more and (2) with modern multi-core PCs, this does not allow the
> concurrent frames to use multiple CPUs which would greatly optimize the
> LCL operations.
The LCL uses various global variables.
It is better to use multiple processes and communicate between them,
e.g. via simpleipc.
Mattias
More information about the Lazarus
mailing list