I’ve not done much beyond very simple stuff with declares, structures or pointers, so please forgive me if this is a stupid question!
if a declare returns a pointer to an array of n structures , as well as the number of structures in the array, and I have defined a Xojo structure for the array elements, can the starting address of of an Xojo structure variable be assigned somehow so i can iterate over the array using the xojo structure?
Usually you pass the Xojo structure variable byRef to the declare, but that obviously would not work for an array…If the # array elements were know at design time creating a Xojo Structure with an Array of structures would be the obvious solutions… but that is not the case…
I could use a memory block but that is a more code , less readable and just plain messy… Alternatively I could copy the correct #of bytes for each each structure in the array to the Xojo structure variable from a memoryblock … but I always hate copying data that should not need to be copied
What I want to be able to do, is something like this if possible:
[code]DIM aStruct as MyStruct
DIM ubStructArray as integer = UBoundArrayElementsFromDeclare
DIM PtrToArray as Ptr = FromDeclare
For i as integer = 0 to ubStructArray
aStruct.Address = PtrToArray
PtrToArray = PtrToArray + aStruct.Size
’ Process the data
Next
[/code]
but i don’t know if it is possible to assign an address to a Xojo Structure variable, or if it is, how to do it.
Thanks,
-Karen