06-04-2025, 01:27 PM
(06-04-2025, 09:15 AM)SMcNeill Wrote: Mem works with arrays; there's no problem with that. The only issue is the entire array is pointed to by the mem block, so if you want to use individual elements yourself, then you have to calcaulate their position manually and fetch only what you need from that segment of the entire array mem block.Maybe I'm being THICK.
For example
DIM a(10), m AS _MEM
m = _MEM(a()) '<-- to point to the array a() and not some variable a
_MEMPUT m, m.OFFSET, 12.34 AS SINGLE
_MEMPUT m, m.OFFSET + 8, 98.76 AS SINGLE
FOR I = 0 TO 10
PRINT a(i)
NEXT
The above will print:
12.34
0
98.76
(and several more 0s)
Notice how I moved my pointer over 8 spaces to put the data into a(2)? If you're looking to address individual elements of your array, you have to track their position manually like above.
That does Happen
I don't see a real practical use for this outside of the normal Array Indexing notation ???? (Unless MEM pointers can be passed between
different program instances, which I don't think is practically possible with User Space code on most 64 bit OS's)