<div id="__MailbirdStyleContent" style="font-size: 10pt;font-family: Arial;color: #000000">Hi all!<div class="mb_sig"></div><div><br></div><div>For some days now, I am thinking about "pointer-to-pointer" types. I suppose that the more general topic is the interpretation of multi-dimensional arrays.</div><div><br></div><div>On the one hand, this is an in-image issue to correctly read ExternalData and to generate appropriate accessors for struct fields.</div><div><br></div><div>On the other hand, this may affect FFI call's arg coercing and return-type packaging.</div><div><br></div><div>So, after playing around with an implementation of pointer-to-pointer types via ExternalType's #referencedType (i.e. making it a chain of three: ... -> void -> void* -> void** -> void ...), I figured that we might need to store the array dimensions in the compiledSpec.</div><div><br></div><div>Here are some unused bits for that:</div><div><img id="9bbaa22c-4c0c-4bdb-83ea-459b9ebee086" src="cid:cd8e4330-974e-4e28-8d83-f2829c97135f" width="auto"></img><br></div><div><div><span style="white-space:pre">    </span>FFIFlagPointerArrayMask := 16rF00000. "up to 16-dimensional arrays"</div><div><span style="white-space:pre"> </span>FFIFlagPointerArrayShift := 20.</div></div><div><br></div><div>Here are some questions for you on this topic:</div><div><br></div><div>- Should we reserve all 4 bits? 16-dimensional arrays sound like overkill ... 2 bits could be enough, having rarely the lower one set for char** ...</div><div>- In the image, would you store all possible versions through refrencedType in a linked cycle? Or would you lazily create them ... on the fly? As requested from struct fields and FFI call specs via ExternalType class >> #typeNamed: ?</div><div>- In the FFI plugin, do you see value in coercing an array of, for example, IntegerArrays for an FFI call? (int**)</div><div>- In the FFI plugin, do you see value in automatically packaging returned objects if those dimensions would be zero-terminated?</div><div><br></div><div>Best,</div><div>Marcel</div></div>