ncDeviceDestroy()

Info Value
Header mvnc.h
Library libmvnc.so
Version 2.0
See also struct ncDeviceHandle_t, ncDeviceCreate(), ncDeviceOpen(), ncDeviceClose()

Overview

This function destroys a handle for a neural compute device and frees associated resources. This function must be called for every device handle that was initialized with ncDeviceCreate().

Upon successful return, the ncDeviceHandle_t struct pointer will be set to NULL.

Before calling this function, you must destroy all ncFifoHandle_t structs and ncGraphHandle_t structs that were allocated to this device and close the device with ncDeviceClose().

Prototype

ncStatus_t ncDeviceDestroy(struct ncDeviceHandle_t** deviceHandle);

Parameters

Name Type Description
deviceHandle struct ncDeviceHandle_t** The address of a pointer to an initialized ncDeviceHandle_t struct.

Return

An appropriate value from the ncStatus_t enumeration.

Notes

None.

Example

#include <stdio.h>
#include <stdlib.h>
#include <mvnc.h>

int main(int argc, char** argv)
{
    ncStatus_t retCode;
    struct ncDeviceHandle_t* deviceHandlePtr;
    
    ncDeviceCreate(0, &deviceHandlePtr);
    ncDeviceOpen(deviceHandlePtr);
    
    // Device handle is ready to use now, pass it to other API calls as needed...
    
    ncDeviceClose(deviceHandlePtr);
    ncDeviceDestroy(&deviceHandlePtr);
}