<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2020/09/24 11:04, Sven Barth via
lazarus wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB-tpBut0-EZ+8XD=mHb5LPbyq+oCvCE2VvHG-Zib1ZKQA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">Bo Berglund via lazarus
<<a href="mailto:lazarus@lists.lazarus-ide.org"
moz-do-not-send="true">lazarus@lists.lazarus-ide.org</a>>
schrieb am Do., 24. Sep. 2020, 08:08:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
>If course there is. That's how the unit system is
supposed to work after<br>
>all.<br>
><br>
Yes, I realize that now.<br>
<br>
It means that the client even though it will not interface
to the<br>
hardware will have all of the code used to do that
included in the<br>
app, right?<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">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.</div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Sven <br>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>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.</p>
<p>Sadly Bo, the entire premise of the Unit system is that every
dependency will be in view, the compiler cannot decide BEFORE
compiling that it would or wouldn't need a unit which appears in a
"unit" clause lower down the dependency tree. Consider that a used
unit may well declare a global variable that overrides one from a
higher-up unit, for instance. So even though the program has all
the participating symbols at hand without looking at this depended
unit with the override, it will produce a different program (than
when that override IS considered) and so cannot simply decide to
ignore/not require a unit preemptively before actually parsing the
physical file.</p>
<p>All units you use, pluse every dependent unit they use, must be
available and visible to the compiler. That rule is absolute.</p>
<p><br>
</p>
</body>
</html>