###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!) # SDL_AttachVirtualJoystick Attach a new virtual joystick. ## Header File Defined in [](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_joystick.h) ## Syntax ```c SDL_JoystickID SDL_AttachVirtualJoystick(const SDL_VirtualJoystickDesc *desc); ``` ## Function Parameters | | | | | ---------------------------------------------------------- | -------- | ----------------------------------------------------------------------------------- | | const [SDL_VirtualJoystickDesc](SDL_VirtualJoystickDesc) * | **desc** | joystick description, initialized using [SDL_INIT_INTERFACE](SDL_INIT_INTERFACE)(). | ## Return Value ([SDL_JoystickID](SDL_JoystickID)) Returns the joystick instance ID, or 0 on failure; call [SDL_GetError](SDL_GetError)() for more information. ## Version This function is available since SDL 3.1.3. ## See Also - [SDL_DetachVirtualJoystick](SDL_DetachVirtualJoystick) ---- [CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategoryJoystick](CategoryJoystick)