[Lazarus] How to find out why a unit is used in a project?

Sven Barth pascaldragon at googlemail.com
Thu Sep 24 14:22:13 CEST 2020


R.Smith via lazarus <lazarus at lists.lazarus-ide.org> schrieb am Do., 24.
Sep. 2020, 12:19:

>
> On 2020/09/24 11:04, Sven Barth via lazarus wrote:
>
> Bo Berglund via lazarus <lazarus at lists.lazarus-ide.org> schrieb am Do.,
> 24. Sep. 2020, 08:08:
>
>>
>> >If course there is. That's how the unit system is supposed to work after
>> >all.
>> >
>> Yes, I realize that now.
>>
>> It means that the client even though it will not interface to the
>> hardware will have all of the code used to do that included in the
>> app, right?
>>
>
> The compiler (and linker) only includes code that is used. Thus as long as
> you don't call the hardware functions anywhere in your program (this
> includes indirectly or through initialization/finalization sections) then
> the code won't be in the final binary either.
>
> Regards,
> Sven
>
>
> Sven, I believe Bo's problem is that even though he won't need the Code
> (which the linker/compiler will surely cleverly disregard), he also do not
> even wish to "need" the physical Unit files to be in view of the compiler -
> at least not the secondary-dependency units - when he references a unit
> file in which he only needs a few declarations visible.
>

Well, Bo could always split the data type declarations into a separate
unit.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20200924/c96e85fb/attachment.html>


More information about the lazarus mailing list