Chapter 4
Developing Your Application
©
National Instruments Corporation
4-5
Additional Compiler Information
When building an application with NI-VISA, you must include
visa.h
in your source code.
When building an application with NI-VXI, you must include
nivxi.h
in your source code.
Refer to the documentation that came with your compiler package for
detailed instructions about using the compiler and the various tools (linker,
debugger, and so on). Your compiler documentation is an important and
useful source of information for writing, compiling, and debugging
C programs.
Compiling Your C Program
You can use the sample programs included with the NI-VXI/NI-VISA
software as a starting point to develop your own C program that uses
NI-VXI/NI-VISA functions. First, look over and compile the sample
program using the makefile provided to get familiar with how the functions
operate. The example program is broken into multiple files, and each file
shows how to use different groups of functions. You can then modify the
sample program to try out different aspects of the NI-VXI/NI-VISA
software.
The easiest way to compile the sample program is to use the makefile
included with the NI-VXI/NI-VISA software. The makefile uses
GNU cc
,
which comes with the VxWorks development kit from Wind River
Systems. The
gcc
executable is
cc386
.
#define Statement Used in NI-VXI
It is necessary to define the
VXIVXWORKS
symbol so that the NI-VXI library
can work properly with your program. You can define the symbol using
#define
statements in the source code or you can use the
-D
option in your
compiler. If you use a
#define
statement, you must define the symbol
before including the NI-VXI header file
nivxi.h
. If you use the makefiles
to compile the sample program, the makefile already defines the necessary
symbol.