VdkDrvFreeCBFnc


Use the VdkDrvFreeCBFnc function to release resources, such as memory for data structures, acquired by your gateway driver. The Verity engine calls your VdkDrvFreeCBFnc function when the driver is no longer in use.


Syntax

VdkError VdkDrvFreeCBFnc(
   VdkCBArg   pdriverHandle)

Arguments

 


pdriverHandle

VdkCBArg   A reference to data available to your driver’s callback functions.


Returns

This function must return one of the following error codes:

VdkSuccess for success

 

VdkError_* for a standard Verity Developer Kit API error as described in the Verity Developer’s Kit Programming Reference.

 

VdkFail for a non-specific error

 


Discussion

In addition to the Verity engine calling your VdkDrvFreeCBFnc function when the driver is no longer in use, you can call VdkDrvFreeCBFnc directly; for example, if your VdkDrvNewCBFnc function results in an error, you may need to free resources allocated in VdkDrvNewCBFnc before terminating.

You should free your driver data, referenced by pdriverHandle, after first releasing all other resources referenced by the driver’s handle.


Example

static VdkError
VDK_CALLBACK VdkDrvFree(VdkCBArg drvHandle)
{
VdkError error = VdkSuccess;

if (!--nDrvCnt) {

/*****************************************
* destroy global gdk library handle here
*****************************************/

error = GdkHandleFree(&pGdkHandle);
}

/****************************************
* free the appData created in VdkDrvNew
****************************************/

if (drvHandle)
free(drvHandle);

return error;
}