Migrating from GPIB32 API to 64-Bit NI4882 API
Starting with NI-488.2 for Linux, version 18.0, and NI-488.2 for macOS, version 19.5, NI-488.2 supports only the 64-bit NI4882 API.
Every effort has been made to have the NI4882 API closely match the GPIB32 API while incorporating API design best practices.
Modifying existing GPIB32 applications to use the 64-bit NI4882 API should require minimal changes. In most cases, changing the include file (ni4882.h instead of ni488.h) and the linked object file is sufficient to compile your application (for macOS, change ni488.framework to ni4882.framework).
There still may be warnings due to changes to the status variable type's signed property. The following list describes the major changes in the NI4882 API.
- Wide variants of functions now use the wchar_t instead of unsigned short type.
- Functions taking in parameters that describe a pointer length now use size_t types.
- Status variables now use the unsigned int type.
-
ThreadIbcntl() has been removed. Macros redirect calls to ThreadIbcnt().
- Global status functions have been added. These are Ibsta(), Iberr(), and Ibcnt(). New code should use these functions instead of ibsta, iberr, or ibcnt/ibcntl.
- Long-term deprecated functions have been completely removed.
- Most configuration functions have been removed; calls to these functions redirect to ibconfig using macros. These are the affected functions:
-
ibpad
-
ibsad
-
ibtmo
-
ibeot
-
ibrsc
-
ibsre
-
ibeos
-
ibdma
-
ibist
-
ibrsv
- Many macro definitions have been improved for programmatic safety.
Complications may arise in several uncommon use cases. The following issues have been encountered:
- Storing function pointers for the ibnotify callback causes a type mismatch on the assignment. To solve this issue, fix the function prototype of the callback to use unsigned int for the status parameters.
- Using function pointers to ibfind causes a preprocessor error, because the ibfind macro requires a one-parameter argument. To solve this issue, point to ibfindA or ibfindW, depending on the unicode convention in your application.
- Configuration functions such as ibpad and ibtmo show up in NI I/O Trace as ibconfig calls. This is because macros redirect the configuration function calls to use ibconfig. Avoid confusion by using ibconfig directly.
In most cases, applications written in the NI4882 API continue to work on older versions of the NI-488.2 software. Certain new ibask and ibconfig options break this backwards compatibility, and those options are easily avoidable by using alternative options. To port an application to a 64-bit environment requires that the application migrate to the NI4882 API and be recompiled.
The following NI4882 API constructs break API compatibility with older versions of NI-488.2:
-
ibask (IbaEOS)
-
ibconfig (IbcEOS)