National Instruments NI-488.2 User Manual

Page 57

Advertising
background image

Chapter 4

Developing Your NI-488.2 Application

NI-488.2 User Manual

4-20

ni.com

your application starts, compile and link your application as shown in the
following examples:

gcc prog.c -lgpibapi

or

g++ prog.cpp -lgpibapi

To have the library dynamically loaded on demand when your application
accesses the library, include

cib.o

during the link phase of your

application, as shown in the following examples:

gcc prog.c cib.o -ldl

or

g++ prog.cpp cib.o -ldl

cib.o

is in

<InstallDir>/natinst/ni4882/lib

, where

<InstallDir>

is the directory where you chose to install the NI-488.2

software. The default is

/usr/local

. The file

cib.o

contains code to

dynamically load the library.

The advantage of the latter way of compiling and linking your application
is that it allows your application to run regardless of whether the NI-488.2
software is installed, as long as it does not make any NI-488.2 calls.

Advertising