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

ページ / 211
Chapter 5
UNIX Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual
5-4
©
 National Instruments Corporation
Non-ANSI Behavior of Sun Solaris 1 ANSI C Library
The C library that comes with Sun Solaris 1 (SunOS 4.1.x) does not comply with the ANSI C 
standard as follows:
Some ANSI C functions are missing from the library.
Some library functions have different behavior than the ANSI standard specifies.
LabWindows/CVI corrects these problems by adding a library, 
libcfix.a
, that 
replaces and supplements the Sun Solaris library as necessary. The 
 section contains more information about how LabWindows/CVI provides an 
ANSI C library on Solaris 1.
LabWindows/CVI Implements printf and scanf
Although the Sun Solaris libraries provide the ANSI C family of functions for formatted input 
and output (
scanf
printf
, and others), LabWindows/CVI provides special versions of 
these functions for the following reasons:
The LabWindows/CVI versions of these functions provide run-time error checking not 
available with Sun Solaris versions.
The Sun Solaris 1 version of these functions do not comply fully with the ANSI C 
standard.
The Sun Solaris versions of these functions do not work with the LabWindows/CVI 
implementation of the long double data type.
For standalone executables, these functions come in a separate static library, 
libcviprintf.a
, in the 
lib
 subdirectory of the LabWindows/CVI installation directory. 
When you create an executable in LabWindows/CVI, LabWindows/CVI links your program 
to this static library.
Main Function Must Call InitCVIRTE
If your program calls any functions from the LabWindows/CVI libraries, you must call 
InitCVIRTE
 to initialize the libraries from the executable. This function takes three 
arguments. The first and third arguments to this function must always be 0 for UNIX 
applications. The second must be the same value as the second parameter of your 
main
 
function. 
InitCVIRTE
 returns 0 if it fails. 
You do not have to call 
InitCVIRTE
 when you run your program in the LabWindows/CVI 
development environment because LabWindows/CVI always initializes the libraries. 
However, if you do not call 
InitCVIRTE
, your executable cannot work. For this reason, 
00ProRef.book : 06chap05.fm  Page 4  Monday, March 9, 1998  3:23 PM