[Lazarus] Form in DLL

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue May 1 15:31:57 CEST 2012


Bernd schrieb:

> I ended up starting a separate thread in my dll, told the RTL that
> this new thread is now the main thread (and was surprised that this
> actually worked) and then wrote my own message loop (because
> application.run did not seem to work properly).

Up to here I'd think that a new TApplication type for DLLs would be a 
nice solution.

> I also had to
> synchronize all other function calls from the host with this thread
> because they came from even more different threads,

This sounds a bit weird. Or is the DLL *assumed* to synchronize all 
these calls with the GUI thread (be application or DLL main thread)?

> At the end it
> worked but it all looked so ridiculously complicated and fragile and I
> had the impression it was sheer coincidence that it actually worked so
> that I finally decided to abandon these experiments and instead make
> the gui part of my dll a separate .exe file that communicates via some
> sort of IPC (I ended up starting the GUI exe with a TProcess and
> send/receive simple commands via stdin/stdout). This still seemed
> somehow complicated but at least it did no dirty undocumented tricks
> with the LCL and seemed quite robust (and enough for my needs).

I'd thought that a SendMessage would serve the same purpose (thread switch).

DoDi





More information about the Lazarus mailing list