National Instruments NI-488.2 User Manual

Page 54

Advertising
background image

Chapter 4

Developing Your NI-488.2 Application

© National Instruments Corporation

4-17

NI-488.2 User Manual

In your Win32 application, you need to load

gpib-32.dll

before

accessing the

gpib-32.dll

exports. The following code fragment shows

you how to call the

LoadLibrary

function to load

gpib-32.dll

and

check for an error:

HINSTANCE Gpib32Lib = NULL;

Gpib32Lib=LoadLibrary("GPIB-32.DLL");

if (Gpib32Lib == NULL) {

return FALSE;

}

For the prototypes for each function, refer to the NI-488.2 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 function’s list of parameters as described in the NI-488.2 Help. For
instructions on accessing the online help, refer to the

Using the 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;

Advertising