viClose

Syntax

viClose(ViSession/ViEvent/ViFindList vi);

Description

This function closes the specified resource manager session, device session, find list (returned from the viFindRsrc function), or event context (returned from the viWaitOnEvent function, or passed to an event handler). In this process, all the data structures that had been allocated for the specified vi are freed.

The viClose function should not be called from within an event handler. In VISA 1.1 and greater, viClose (VI_NULL) returns VI_WARN_NULL_OBJECT rather than an error.

Parameters

Name

Dir

Type

Description

vi

IN

ViSession
ViEvent
ViFindlist

Unique logical identifier to a session, event, or find list.

Return Values

Type ViStatus

This is the function return status. It returns either a completion code or an error code as follows.

Completion Code

Description

VI_SUCCESS

Operation completed successfully.

VI_WARN_NULL_OBJECT

The specified object reference is uninitialized.

Error Code

Description

VI_ERROR_CLOSING_FAILED

Unable to deallocate the previously allocated data structures corresponding to this session or object reference.

VI_ERROR_INV_SESSION
VI_ERROR_INV_OBJECT

The given session or object reference is invalid (both are the same value).

C# Example

public void CloseSession(int session) { visa32.viClose(session); }

VB .NET Example

Public Sub CloseSession(ByVal session As Integer)    visa32.viClose(session) End Sub

See Also

viOpen, viFindRsrc, viWaitOnEvent, viEventHandler