# %shmat() function

The %shmat() function attaches a shared
memory segment associated with the shared memory identifier *shmid* and returns the address of the segment.

**For Windows:**Not Supported

## Syntax

```
pointer = (char*)%shmat(shmid, (char*)shmaddr, shmflg)
```

## Description

Valid values for *shmflg* are defined in shm.h and ipc.h. See the UNIX system documentation.

Warning: It is strongly advised to use only the form
where *shmaddr* is 0, to let the system select the
address.

## See also

- [%shmdt() function](https://d3codex.com/pickbasic-flashbasic/percent-shmdt-function/)
- [%shmget() function](https://d3codex.com/pickbasic-flashbasic/percent-shmget-function/)
- [FlashBASIC C functions overview](https://d3codex.com/pickbasic-flashbasic/flashbasic-c-functions-overview/)
- [cfunction statement](https://d3codex.com/pickbasic-flashbasic/cfunction-statement/)

---
Source: https://d3codex.com/pickbasic-flashbasic/percent-shmat-function/ - part of the D3Codex reference.
