[Lazarus] Threads and Libraries (dll and so)

Marcos Douglas md at delfire.net
Fri Jan 17 17:47:20 CET 2014


On Fri, Jan 17, 2014 at 12:38 PM, Mark Morgan Lloyd
<markMLl.lazarus at telemetry.co.uk> wrote:
> Marcos Douglas wrote:
>
>> But why do you need a global var in the DLL? IMHO (and for many
>> programmers around the world), global var is not good, even in the
>> application code.
>
>
> Although I think that this is in part "received wisdom", dating back to some
> of the earliest ALGOL computers where globals were a comparatively scarce
> resource which couldn't be swapped with the same ease as variables on the
> stack or storage on the heap.

I said: IMHO, not only "programmers around the world"... so, for me is
not a "received wisdom", but a lesson learned.  ;-)

> If they really were so unutterably bad, I'd like to think that the designers
> of Delphi would have gone to more trouble to define forms as something
> non-global.

I think so. The design using global variables, components as published
not private... I'd like to think they chosen a simple and fast way to
code.

> So going back to the specific question, as I understand it you get a global
> in a DLL if you define a form in it. In practical terms it might not be
> immediately usable, but as an example I've used a form in a DLL as a
> template and copied menu entries from it to an appropriate form in the main
> app.

I think this is not his problem... but I could be wrong.

Best regards,
Marcos Douglas




More information about the Lazarus mailing list