# GetMemPtr
{: .no_toc }

Reads a pointer-sized value from a memory address into a **LongPtr** variable.

Syntax: **GetMemPtr** *Address* **,** *retVal*

*Address*
: *required* **LongPtr**. The address to read from.

*retVal*
: *required* **LongPtr**. The variable to receive the pointer-sized value read from *Address*.

The number of bytes read matches the host's pointer width --- four bytes in 32-bit builds, eight bytes in 64-bit builds. The bytes are interpreted in the host's native byte order. The address is read directly with no bounds or alignment check.

### Common Errors

| Error | When |
|---|---|
| [94 (`&H5E`)](/Reference/Run-time-Errors.md#94), *Invalid use of Null* | *Address* is **Null** |

### Example

```tb check_build
' Read the IUnknown vtable pointer of a Collection instance.
Dim c As Collection = New Collection
Dim vtbl As LongPtr
GetMemPtr ObjPtr(c), vtbl
Debug.Print "vtable at "; Hex(vtbl)
```

### See Also

- [GetMem1](/tB/Modules/HiddenModule/GetMem1.md), [GetMem2](/tB/Modules/HiddenModule/GetMem2.md), [GetMem4](/tB/Modules/HiddenModule/GetMem4.md), [GetMem8](/tB/Modules/HiddenModule/GetMem8.md) procedures
- [PutMemPtr](/tB/Modules/HiddenModule/PutMemPtr.md) procedure
