()()
Syntax
viOpenDefaultRM(out int sesn);
Description
Opens the default VISA Resource Manager, the Class Factory1 VISA Object that knows how to find and open VISA resources. This function must be called before any other VISA functions can be invoked. The first call to this function initializes the VISA system, including the Default Resource Manager resource, and also returns a session to that resource. Subsequent calls to this function return unique sessions to the same Default Resource Manager resource.
Parameters
Name |
Dir |
Type |
Description |
sesn |
OUT |
int |
Unique logical identifier to a Default Resource Manager session. |
Return Values
Completion Code |
Description |
VI_SUCCESS |
Session to the Default Resource Manager resource created successfully. |
Error Codes |
Description |
VI_ERROR_ALLOC |
Insufficient system resources to create a session to the Default Resource Manager resource. |
VI_ERROR_INV_SETUP |
Some implementation-specific configuration file is corrupt or does not exist. |
VI_ERROR_SYSTEM_ERROR |
The VISA system failed to initialize. |
C# Example
public int OpenRM() { int resourceManager, viError; viError = visa32.viOpenDefaultRM(out resourceManager); if (viError < visa32.VI_SUCCESS) throw new ApplicationException( "Failed to open Resource Manager"); return resourceManager; }
VB .NET Example
Public Function OpenRM() As Integer Dim resourceManager As Integer = 0, viError As Integer viError = visa32.viOpenDefaultRM(resourceManager) If viError < visa32.VI_SUCCESS Then Throw New ApplicationException("Failed to open Resource Manager") End If Return resourceManager End Function
1See the excellent book Design Patterns, Gamma et al, for more information about the Class Factory pattern and other commonly used patterns in software systems.