Interface IObjectPointers
The addresses a session gives its objects (ObjPtr, RD-VBAL §6.1.2.13), read both ways: the address an object is laid out as in the
bytes of a record, and the object an address read from those bytes is. A copy of a record as bytes (LSet, MS-VBAL §5.4.3.6) reads
them this way when an object field and a field of another type overlap.
public interface IObjectPointers
Remarks
A session's storage gives its objects their addresses, so ISessionStorage extends this interface.
⚖️RDCore provides an implementation of this interface licensed under GPLv3.
Properties
PointerWidth
The host's pointer width in bytes: 8 in a 64-bit environment, 4 in a 32-bit one. The layout of a record depends on it.
int PointerWidth { get; }
Property Value
Methods
TryGetObject(long, out VBRuntimeObjectId)
The object whose interface is at pointer, an address ObjPtr returned: Nothing for 0.
bool TryGetObject(long pointer, out VBRuntimeObjectId instance)
Parameters
pointerlongThe address.
instanceVBRuntimeObjectIdThe object.
Returns
Remarks
The address of an object that was destroyed resolves to no object, and the session may give it to an interface of another object.
TryGetPointer(VBRuntimeObjectId, VBType?, out long)
The address of the interface of instance that declared selects: what ObjPtr returns of a variable of that
type that holds it, and 0 for Nothing.
bool TryGetPointer(VBRuntimeObjectId instance, VBType? declared, out long pointer)
Parameters
instanceVBRuntimeObjectIdThe object.
declaredVBTypeThe declared type of what holds it: a class,
Object, or null for the class's own interface.pointerlongThe address.
Returns
Remarks
The first time an interface of an object is asked for, its address is allocated in the session's memory. It is the same address for as long as the object lives.