Chapter 3 Developing Your NI-488.2 Application
© National Instruments Corporation 3-15 NI-488.2 User Manual for Windows
For the prototypes for each function, refer to the NI-488.2 online help. For
instructions on accessing the online help, refer to the Using the NI-488.2
Documentation section in About This Manual.
For functions that return an integer value, like ibdev or ibwrt, the pointer
to the function needs to be cast as follows:
int (_stdcall *Pname)
where *Pname is the name of the pointer to the function. For functions that
do not return a value, like FindLstn or SendList, the pointer to the
function needs to be cast as follows:
void (_stdcall *Pname)
where *Pname is the name of the pointer to the function. They are followed
by the functions list of parameters as described in the NI-488.2 online help.
For instructions on accessing the online help, refer to the Usingthe
NI-488.2 Documentation section in About This Manual.
Following is an example of how to cast the function pointer and how the
parameter list is set up for ibdev and ibonl functions:
int (_stdcall *Pibdev)(int ud, int pad, int sad, int tmo,
int eot, int eos);
int (_stdcall *Pibonl)(int ud, int v);
Next, your Win32 application needs to use GetProcAddress to get the
addresses of the global status variables and functions your application
needs. The following code fragment shows you how to get the addresses of
the pointers to the status variables and any functions your application
needs:
/* Pointers to NI-488.2 global status variables */
int *Pibsta;
int *Piberr;
long *Pibcntl;
static int(__stdcall *Pibdev)
(int ud, int pad, int sad, int tmo, int eot,
int eos);
static int(__stdcall *Pibonl)
(int ud, int v);
Pibsta = (int *) GetProcAddress(Gpib32Lib,
(LPCSTR)"user_ibsta");
Piberr = (int *) GetProcAddress(Gpib32Lib,
(LPCSTR)"user_iberr");