---
name: "SDL_AttachVirtualJoystick"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_AttachVirtualJoystick"
---

# SDL\_AttachVirtualJoystick(3)

Attach a new virtual joystick.

## NAME

SDL\_AttachVirtualJoystick - Attach a new virtual joystick.

## HEADER FILE

Defined in SDL3/SDL\_joystick.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_JoystickID SDL\_AttachVirtualJoystick(const SDL\_VirtualJoystickDesc \*desc);**

## FUNCTION PARAMETERS

- *desc*

  joystick description, initialized using  **SDL\_INIT\_INTERFACE** ().

## RETURN VALUE

( **SDL\_JoystickID** ) Returns the joystick instance ID, or 0 on failure; call  **SDL\_GetError** () for more information.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_DetachVirtualJoystick**(3)](/SDL_DetachVirtualJoystick/3.md)
