[Lazarus] Form in DLL

Michael Schnell mschnell at lumino.de
Thu May 3 15:26:55 CEST 2012

On 05/03/2012 03:16 PM, Mark Morgan Lloyd wrote:
> even if that meant that they were built up step-by-step under code 
> control rather than constructed from a description in resources.
Yep. If you don't want to create a tool that uses the resources in the 
DLL  and constructs the GUI from same, you can't use the Lazarus form 
designer and need to write code to manually add the controls you need 
for your plugin. IMHO it should not be too hard to do such a tool, as 
this is exactly what is done by the program startup code, anyway. You 
just need to take a look at the LCL part that does this 
(TApplication.CreateForm, when creating a non-Main form) and take out 
what you think is useful for that purpose. But (as said) you need to use 
the LCL of the main project, not that of the DLL. So the tool should be 
done in the main program, so that it attaches to the correct Application 
instance. You then need to pass the address of the resource to same when 
the DLL is "started" (e.g. by providing a function that returns that 
address). Beware, that the memory management should be unified before.


More information about the Lazarus mailing list