National Instruments 320685D-01 ユーザーズマニュアル

ページ / 211
Chapter 5
UNIX Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual
5-6
©
 National Instruments Corporation
Using Externally Compiled Modules
In general, you can load objects compiled with the Sun compilers and the GNU 
gcc
 compiler 
into LabWindows/CVI, with a few restrictions.
Restrictions on Externally Compiled Modules
You can use externally compiled modules with the following restrictions:
The objects must not use any data types that are incompatible with the LabWindows/CVI 
compiler or libraries. Incompatible data types include the following:
long
 
double
 with any Sun compilers. A Sun compiler implements 
long
 
double
 
as a 16-byte object, but LabWindows/CVI implements it as an 8-byte object.
long
 
long
 with the Solaris 2 Sun compiler. LabWindows/CVI does not support this 
non-ANSI type.
Any enumeration type. Many compilers implement enumeration types with different 
sizes and values.
You cannot load a Solaris 2 object file when you run LabWindows/CVI under Solaris 1. 
However, you can load Solaris 1 objects when you run under Solaris 2. 
Compiling Modules With External Compilers
You can compile external modules using LabWindows/CVI header files instead of the headers 
the compiler supplies. To compile this way, you must define the preprocessor macro 
_NI_sparc_ 
to the value 
1
 for Solaris 1 or to the value 
2
 for Solaris 2.
When using the Sun ANSI C compiler, use the 
-I
 flag to add the LabWindows/CVI include 
directory to the search list, as shown in the following command lines:
Solaris 1: acc -Xc -I/home/cvi/include -D_NI_sparc_=1 -c mysource.c
Solaris 2: cc -Xc -I/home/cvi/include -D_NI_sparc_=2 -c mysource.c
When using the GNU compiler, use the 
-nostdinc
 flag to disable the standard include files 
and the 
-I
 flag to add the LabWindows/CVI include directory to the search list. Also, you 
must use the 
-ansi
 flag. For example, to compile the file 
mysource.c
 using 
LabWindows/CVI headers under Solaris 1, use the following command line.
gcc -ansi -nostdinc -I/home/cvi/include -D_NI_sparc_=1 -c mysource.c
You might see warnings about conflicting types for the built-in functions 
memcmp
 and 
memcpy
, but you can ignore them.
Note
These examples assume that 
/home/cvi/include
 is the LabWindows/CVI 
header files directory. The actual path depends on how you install your copy of 
LabWindows/CVI.
00ProRef.book : 06chap05.fm  Page 6  Monday, March 9, 1998  3:23 PM