[Lazarus] global items in TApplication
Graeme Geldenhuys
graeme at geldenhuys.co.uk
Mon Sep 16 09:53:03 CEST 2013
On 2013-09-15 15:57, Martin wrote:
> global war, but in implementation
>
Correct, or just use a "lazyman's singleton" function.
----8<-------------8<-------------8<-------------8<-------------8<----
interface
function GlobalFoo: TFoo;
implementation
var
uFoo: TFoo;
function GlobalFoo: TFoo;
begin
if uFoo = nil then
uFoo := TFoo.Create;
Result := uFoo;
end;
initialization
uFoo := nil;
finalization
uFroo.Free;
----8<-------------8<-------------8<-------------8<-------------8<----
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/
More information about the Lazarus
mailing list