<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">lazarus@lists.lazarus-ide.org</a>> schrieb am Do., 24. Sep. 2020, 15:22:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, 24 Sep 2020 14:22:13 +0200, Sven Barth via lazarus<br>
<<a href="mailto:lazarus@lists.lazarus-ide.org" target="_blank" rel="noreferrer">lazarus@lists.lazarus-ide.org</a>> wrote:<br>
<br>
>Well, Bo could always split the data type declarations into a separate<br>
>unit.<br>
<br>
But I cannot wrap my head around this (constructed example):<br>
<br>
interface<br>
<br>
type<br>
TMyRecord = packed record<br>
Item1: word;<br>
Item2: Cardinal;<br>
end;<br>
<br>
<br>
TMyController = class<br>
private<br>
FGPIO_driver: TIoDriver;<br>
FGpF: TIoPort;<br>
function CheckValidRelay(Relay: byte): boolean;<br>
public<br>
constructor Create;<br>
destructor Destroy; override;<br>
procedure ClearRelays;<br>
function PulseRelay(Relay: byte; PulseTime: LongWord): boolean;<br>
function RelayOff(Relay: byte): boolean;<br>
function RelayOn(Relay: byte): boolean;<br>
function RelayState(Relay: byte): boolean;<br>
procedure Delay(T: LongWord);<br>
end;<br>
<br>
implementation<br>
...All of the methods here...<br>
<br>
AFAIK the records could be declared elsewhere but the objects not<br>
since their methods, constructor, destructor etc reside in the same<br>
file below implementation, right?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">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). </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Just specifying a uses file with everything above the implementation<br>
will not cut it, right?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">No, that will not help.</div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>