---
title: "FFCreateDevice(_:_:)"
framework: Force Feedback
role: symbol
role_heading: Function
platforms: [Mac Catalyst 13.0+, macOS 10.2+]
path: "forcefeedback/ffcreatedevice(_:_:)"
---

# FFCreateDevice(_:_:)

Creates a new API device object from an OS object in preparation to use the device for force feedback.

## Declaration

```swift
func FFCreateDevice(_ hidDevice: io_service_t, _ pDeviceReference: UnsafeMutablePointer<FFDeviceObjectReference?>!) -> HRESULT
```

## Parameters

- `hidDevice`: Pointer to a HID device object.
- `pDeviceReference`: Address of a variable to receive an opaque reference handle to a new device object. This reference can be used in subsequent calls to FFDevice* functions

## Return Value

Return Value If the method succeeds, and the device supports FF, the return value is FF_OK. If the method fails, the return value can be one of the following error values:

## Discussion

Discussion FFERR_INVALIDPARAM FFERR_NOINTERFACE FFERR_OUTOFMEMORY FFERR_INTERNAL Discussion When you are finished with the device, FFReleaseDevice must be called on the reference received in this function to dispose of the API device object.

## See Also

### Miscellaneous

- [FFDeviceCreateEffect(_:_:_:_:)](forcefeedback/ffdevicecreateeffect(_:_:_:_:).md)
- [FFDeviceEscape(_:_:)](forcefeedback/ffdeviceescape(_:_:).md)
- [FFDeviceGetForceFeedbackCapabilities(_:_:)](forcefeedback/ffdevicegetforcefeedbackcapabilities(_:_:).md)
- [FFDeviceGetForceFeedbackProperty(_:_:_:_:)](forcefeedback/ffdevicegetforcefeedbackproperty(_:_:_:_:).md)
- [FFDeviceGetForceFeedbackState(_:_:)](forcefeedback/ffdevicegetforcefeedbackstate(_:_:).md)
- [FFDeviceReleaseEffect(_:_:)](forcefeedback/ffdevicereleaseeffect(_:_:).md)
- [FFDeviceSendForceFeedbackCommand(_:_:)](forcefeedback/ffdevicesendforcefeedbackcommand(_:_:).md)
- [FFDeviceSetCooperativeLevel(_:_:_:)](forcefeedback/ffdevicesetcooperativelevel(_:_:_:).md)
- [FFDeviceSetForceFeedbackProperty(_:_:_:)](forcefeedback/ffdevicesetforcefeedbackproperty(_:_:_:).md)
- [FFEffectDownload(_:)](forcefeedback/ffeffectdownload(_:).md)
- [FFEffectEscape(_:_:)](forcefeedback/ffeffectescape(_:_:).md)
- [FFEffectGetEffectStatus(_:_:)](forcefeedback/ffeffectgeteffectstatus(_:_:).md)
- [FFEffectGetParameters(_:_:_:)](forcefeedback/ffeffectgetparameters(_:_:_:).md)
- [FFEffectSetParameters(_:_:_:)](forcefeedback/ffeffectsetparameters(_:_:_:).md)
- [FFEffectStart(_:_:_:)](forcefeedback/ffeffectstart(_:_:_:).md)
