Can't you use HandleFromObject and HandleToObject instead of byte ptrs?
Otherwise this dirty (which may fail in a million different cases) trick can be used:
Otherwise this dirty (which may fail in a million different cases) trick can be used:
Type TJimmy Global list:TList = New TList Field great:Int = 1234 Method New() list.addlast Self EndMethod Function FromBytePtr:TJimmy(b:Byte Ptr) For Local j:TJimmy = EachIn list If Byte Ptr(Varptr(j))[0] = b[0] Return j EndIf Next EndFunction EndType New TJimmy Local j:TJimmy = New TJimmy j.great = 1456 Local k:Byte Ptr = Varptr(j) Local i:TJimmy = TJimmy.FromBytePtr(k) If i Print "Jimmy.great = "+i.great Else Print "Couldn't find Jimmy!" EndIf