# swiCloseSwitch

Closes a switching device and invalidates the specified switch handle
.

#### Prototype

DWORD swiCloseSwitch ( SWIHD swihd)

Argument | Description
swihd | Switch handle.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_HANDLE | swihd is not a valid switch handle.
CTAERR_SVR_COMM | Communication error in the server environment.

#### Details

swiCloseSwitch frees memory associated with the open switch handle and invalidates the handle. If the switch handle was opened with the SWI_ENABLE_RESTORE flag set in swiOpenSwitch, switch block outputs affected by switching calls (using this handle) are restored to the state they were in when swiOpenSwitch was called.

If CTAERR_DRIVER_ERROR is returned, call swiGetLastError to retrieve the MVIP device error code.

For more information, refer to Closing a switch handle.

#### Example

void myApplicationShutdown(SWIHD hd[], unsigned count)
{
unsigned i;
for (i = 0; i < count; i++)
{
swiCloseSwitch(hd[i]);
}
}