[Lazarus] How to find out why a unit is used in a project?
Sven Barth
pascaldragon at googlemail.com
Thu Sep 24 17:06:23 CEST 2020
Bo Berglund via lazarus <lazarus at lists.lazarus-ide.org> schrieb am Do., 24.
Sep. 2020, 15:22:
> On Thu, 24 Sep 2020 14:22:13 +0200, Sven Barth via lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>
> >Well, Bo could always split the data type declarations into a separate
> >unit.
>
> But I cannot wrap my head around this (constructed example):
>
> interface
>
> type
> TMyRecord = packed record
> Item1: word;
> Item2: Cardinal;
> end;
>
>
> TMyController = class
> private
> FGPIO_driver: TIoDriver;
> FGpF: TIoPort;
> function CheckValidRelay(Relay: byte): boolean;
> public
> constructor Create;
> destructor Destroy; override;
> procedure ClearRelays;
> function PulseRelay(Relay: byte; PulseTime: LongWord): boolean;
> function RelayOff(Relay: byte): boolean;
> function RelayOn(Relay: byte): boolean;
> function RelayState(Relay: byte): boolean;
> procedure Delay(T: LongWord);
> end;
>
> implementation
> ...All of the methods here...
>
> AFAIK the records could be declared elsewhere but the objects not
> since their methods, constructor, destructor etc reside in the same
> file below implementation, right?
>
Would your code require the hypothetical TMyController or only the
TMyRecord? If it only requires the later then you could indeed solve this
by moving the record into a separate unit. If your code requires
TMyController as well, then it can't be left out anyway (though the
compiler will leave out any non-virtual method of that class which isn't
used).
> Just specifying a uses file with everything above the implementation
> will not cut it, right?
>
No, that will not help.
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200924/61803f60/attachment-0001.html>
More information about the lazarus
mailing list