<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">DJ Coertzen <<a href="mailto:patrolliekaptein@gmail.com">patrolliekaptein@gmail.com</a>> schrieb am Mi., 27. März 2019, 18:27:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div>Hi there,</div><div><br></div><div>I need a solution for a packed record containing 4-byte 32-bit integers and cardinals, and other byte 8 bit and word 16 bit sized variables to overlay over a stream.</div><div><br></div><div>Example:</div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">type</span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">  TMyBinaryHeader = packed record</span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">    Sender    : Cardinal;</span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">    Target    : Cardinal;<br></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">    Reference : Integer;    <br></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">    Flags     : Word;<br></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">    <span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">CheckByte : Byte;</span></b></span></span></b></span></div><div><span style="color:rgb(0,0,255)"><b><span style="font-family:monospace,monospace">  end;</span></b></span></div><div><br></div><div>So on 32 bit systems, SizeOf(TMyBinaryHeader) will report 15 bytes. How do I accomplish this on 64 bit platform and avoiding "myprotocollib.pas(x,y) Error: Typecast has different size (4 -> 8) in assignment" without having to port to ugly byte copy operations.</div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Would you show the code at/around the error location, please? I suspect that it isn't the record that's the problem, but how you use it. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </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">
</blockquote></div></div></div>