Device Function

New

dev_New()

Create a new device.

Syntax
#include "device.h"

LResult dev_New
    (
        LDeviceName    deviceName,
        LDevice *      deviceOut
    );
deviceNamename of device in device database
deviceOutspace for output of new device
Description

dev_New() retrieves the device definition from the device database and allocates memory for the device data structure and initializes it with the device definition. It does not try to open the device. Devices created with dev_New() should be disposed of by calling dev_Dispose().

Return Values

If successful, dev_New() returns a non-negative value. Otherwise, it returns a negative value indicating the reason it failed. Possible unsuccessful return values are:

See Also

dev_Dispose()

Example
if ((result = dev_New(deviceName, &device)) < 0)
{
    LOG("New failure", dev_ErrorMessage(result));
}
else
{
    assert(device != NULL);
}