# GetMem8
{: .no_toc }

Reads eight bytes from a memory address into a **Currency** variable.

Syntax: **GetMem8** *Address* **,** *retVal*

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

*retVal*
: *required* **Currency**. The variable to receive the bytes read from *Address*.

**Currency** is the convenient eight-byte signed-integer carrier used by these primitives because of its in-memory representation; the resulting bits are the raw 64-bit pattern stored at *Address*, scaled by the **Currency** type's fixed factor of 10000 only at the point of arithmetic. To work with the bits as an unscaled 64-bit integer, [**LSet**](/tB/Core/LSet.md) the **Currency** value into a **LongLong** variable.

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

This example writes an 8-byte value to a buffer and reads it back with **GetMem8**.

```tb check_build
Dim buf As LongPtr = AllocMem(8)
Dim src As Currency = 1000000@
PutMem8 buf, src
Dim dst As Currency
GetMem8 buf, dst        ' dst = src (same raw 8-byte pattern)
FreeMem buf
```

### See Also

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