Chapter 3 Developing Your NI-488.2 Application
NI-488.2 User Manual for Windows 3-16 www.natinst.com
Pibcntl = (long *) GetProcAddress(Gpib32Lib,
(LPCSTR)"user_ibcnt");
Pibdev = (int (__stdcall *)
(int, int, int, int, int, int))
GetProcAddress(Gpib32Lib, (LPCSTR)"ibdev");
Pibonl = (int (__stdcall *)(int, int))
GetProcAddress(Gpib32Lib, (LPCSTR)"ibonl");
If
GetProcAddress
fails, it returns a NULL pointer. The following
code fragment shows you how to verify that none of the calls to
GetProcAddress
failed:
if ((Pibsta == NULL) ||
(Piberr == NULL) ||
(Pibcntl == NULL) ||
(Pibdev == NULL) ||
(Pibonl == NULL)) {
/* Free the GPIB library */
FreeLibrary(Gpib32Lib);
printf("GetProcAddress failed.");
}
Your Win32 application needs to dereference the pointer to access either
the status variables or function. The following code shows you how to call
a function and access the status variable from within your application:
dvm = (*Pibdev) (0, 1, 0, T10s, 1, 0);
if (*Pibsta & ERR) {
printf("Call failed");
}
Before exiting your application, you need to free
gpib-32.dll
with the
following command:
FreeLibrary(Gpib32Lib);
For more examples of directly accessing
gpib-32.dll
, refer to the direct
entry sample programs
dlldevquery.c
and
dll4882query.c
, installed
with the NI-488.2 software. For more information about direct entry, refer
to the online help for your development environment.