Chapter 3 Developing Your Application
© National Instruments Corp. 3-21 NI-488.2 User Manual for Windows
The prototypes for each function can be found in the NI-488.2 Function Reference
Manual for DOS/Windows. For functions that return an integer value, like ibdev , you
must cast the pointer to the function as follows:
int(_far _pascal *Pname)
where *Pname is the name of the pointer to the function. For functions (that is, the
NI-488.2 calls) that do not return a value, you must cast the pointer to the function as
follows:
void(_far _pascal *Pname)
where *Pname is the name of the pointer to the function. A function is followed by its
list of parameters and pointers to the three global variables, as described in the NI-488.2
Function Reference Manual for DOS/Windows. The following is an example of how to
cast the function pointer and how to set up the parameter list for ibdev and ibonl:
int(_far _pascal *Pibdev)(int BdIndx, int pad, int sad,
int tmo, int eot, int eos, int _far *ibsta,
int _far *iberr, long _far *ibcntl);
int(_far _pascal *Pibonl)(int ud, int v, int _far *ibsta,
int _far *iberr, long _far *ibcntl);
You must load the GPIB.DLL library within your application program. The following
code calls the LoadLibrary function and handles errors:
GpibLib=LoadLibrary("GPIB.DLL");
if (GpibLib <= HINSTANCE_ERROR)
{
return FALSE;
}
Next you must get the address and assign it to the function pointer by using the
GetProcAddress function. This code goes in your application program.
Pibdev=(int (_far _pascal *)(int, int, int, int, int, int,
int _far*, int _far *, long _far *))
GetProcAddress(GpibLib,(LPCSTR)"DLLibdev");
Pibonl=(int (_far _pascal *)(int, int, int _far *, int _far *,
long _far *))GetProcAddress(GpibLib,
(LPCSTR)"DLLibonl");