MemoryBlock.Ptr
From Xojo Documentation
Supported for all project types and targets.
Gets or sets a MemoryBlock at the specified offset. Offset is in bytes from the beginning of the MemoryBlock.
Notes
If the MemoryBlock's size is not known, then the MemoryBlock this returns will also have an unknown (-1) size, although it can still be used to access its data.
MemoryBlocks automatically convert to Ptr.
This code converts a MemoryBlock to a Ptr:
This code retrieves another MemoryBlock (within the original MemoryBlock) at the specified offset and converts it to a Ptr:
Sample Code
This example stores a Ptr to a MemoryBlock property. If the MemoryBlock property goes out of scope, the Ptr will be invalid when retrieved.
MBProperty.StringValue(0, 8) = "a string"
Var mb As New MemoryBlock(8)
Var p As Ptr = MBProperty
mb.Ptr(0) = p
Because of implicit conversion between a Ptr and MemoryBlock, this can be shortened.
This code will retrieve the MemoryBlock later.
Var s As String = mb1.StringValue(0, 8)
This code will store a Ptrs to two methods.