[Lazarus] How to configure IDE for my own libraries?

José Mejuto joshyfun at gmail.com
Wed Sep 1 23:58:52 CEST 2010


Hello Lazarus-List,

Wednesday, September 1, 2010, 11:21:54 PM, you wrote:

FC> When you put a number of files in a package will the units that are not used
FC> by compiled into the program?

If they do not have initialization or finalization sections, and no
functions are being used I think they are compiled but not linked in.

The initialization and finalization usually introduce non expected
code in the final program. Example, think in an unit like:

-------------------------------
unit DoNothing

uses someuses...;

type
  TMyUselessObject=class(TObject);
    T: TreeView;
  end;

var
  MyUselessObject: TMyUselessObject;

initialization
  MyUselessObject=nil;
-------------------------------

The simple reference in the initialization pulls in all the code in
the unit related to TMyUselessObject even when you do not use
TMyUselessObject in you code. And as TMyUselessObject uses a TreeView
(in example) all the TreeView code is pulled in, which finally will
pull in almost all the LCL even if your code does not use LCL at all.

I'm quite sure about this, but maybe a more authorized voice can
confirm.

PS: I'm not sure about non referenced global arrays or variables :-?

-- 
Best regards,
 José





More information about the Lazarus mailing list