niBTSG_OpenSession
- Updated2025-04-08
- 2 minute(s) read
Looks up an existing niBT SG session using the sessionName parameter and returns the refnum that you can pass to subsequent niBT SG functions. If the lookup fails, the niBTSG_OpenSession function creates a new niBT SG session and returns a new refnum.
Syntax
int32 __stdcall niBTSG_OpenSession(ViChar sessionName, int32 toolkitCompatibilityVersion, niBTSGSession *session, int32 *isNewSession)
Parameters
Name | Direction | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
sessionName | [out] | ViChar | Specifies the name of the session that you are looking up or creating. If a session with the same name already exists, this function returns a reference to that session. To get the reference to an already-opened session x, specify x as the session name. You can obtain the reference to an existing session multiple times if you have not called the niBTSG_CloseSession function in that session. You do not need to close the session multiple times. To create an unnamed session, pass an empty string or NULL to the sessionName parameter. Tip- NI recommends that you call the niBTSG_CloseSession function for each uniquely named instance of the niBTSG_OpenSession function or each instance of the niBTSG_OpenSession function with an unnamed session. | ||||||
toolkitCompatibilityVersion | [in] | int32 | Specifies the version of the BT Generation to which the current version of the BT Generation is compatible. If the behavior of the BT Generation changes in a new version, use this parameter to specify that you want to continue using the behavior of the previous release.
| ||||||
session | [out] | niBTSGSession * | Returns the niBT SG session. | ||||||
isNewSession | [out] | int32 * | Indicates whether the function creates a new session.
|
Returns
Returns the status code of this operation. The status code either indicates success or describes an error or warning. Examine the status code from each call to an niBT SG function to determine if an error has occurred. To obtain a text description of the status code and additional information about the error condition, call the niBTSG_GetErrorString function. The general meaning of the status code is as follows:
Value | Meaning |
---|---|
0 | Success |
Positive Values | Warnings |
Negative Values | Errors |