<div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu 21. May 2020 at 00:30, Marcel Taeumel <<a href="mailto:marcel.taeumel@hpi.de">marcel.taeumel@hpi.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id="m_1108347946976773069__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:#000000"><br><div><br></div><div>Latest thing -- that's why this question about ByteArrays -- was how to re-think this code:</div><div><br></div><div>MyStruct foo;</div><div>someFunctionFillsMyStruct(&foo);</div><div><br></div><div>Into this code:</div><div><br></div><div>foo := MyStruct new. "handle is ByteArray"</div><div>self apiSomeFunctionFillsMyStruct: foo.</div><div><br></div><div>Meaning, what whould be on the stack in C, can conveniently be hold in Squeak's object memory to be shared across Squeak processes and applications.</div></div></blockquote><div dir="auto"><br></div><div dir="auto">I was under the impression that is exactly how it works.</div><div dir="auto"><br></div><div dir="auto">You just need to make a ByteArray that is large enough to hold the struct. Passing that to FFI will pass a pointer to the first byte of the ByteArray. The API call would fill the ByteArray. So it should Just Work.</div><div dir="auto"><br></div><div dir="auto">- Vanessa -</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id="m_1108347946976773069__MailbirdStyleContent" style="font-size:10pt;font-family:Arial;color:#000000"><div></div></div></blockquote></div></div>