National Instruments 320685D-01 ユーザーズマニュアル
©
National Instruments Corporation
6-1
LabWindows/CVI Programmer Reference Manual
6
Building Multiplatform
Applications
Applications
This chapter contains guidelines and caveats for writing platform-independent
LabWindows/CVI applications. LabWindows/CVI currently runs under Windows 3.1
and Windows 95/NT for the PC, and Solaris 1 and Solaris 2 for the SPARCstation.
LabWindows/CVI applications. LabWindows/CVI currently runs under Windows 3.1
and Windows 95/NT for the PC, and Solaris 1 and Solaris 2 for the SPARCstation.
One major feature of LabWindows/CVI is that it supports multiplatform programming.
Following a few simple guidelines assures the portability of a LabWindows/CVI application:
Following a few simple guidelines assures the portability of a LabWindows/CVI application:
•
Write code in strict ANSI C.
•
Observe and repair all LabWindows/CVI compile, link, and run-time diagnostics.
•
Avoid using system dependent calls when possible.
•
Avoid using non-portable image formats and fonts in your user interface.
Multiplatform Programming Guidelines
LabWindows/CVI is portable because it uses ANSI C program files, LabWindows/CVI User
Interface Resource files, and National Instruments libraries.
Interface Resource files, and National Instruments libraries.
You must segregate any platform dependent code in your source code using conditional
preprocessor directives. You can use the built-in macros, such as
preprocessor directives. You can use the built-in macros, such as
_NI_mswin32_
,
_NI_mswin16_
,
_NI_mswin_
,
_NI_unix_
and
_NI_sparc_
. More information on the
macros that LabWindows/CVI automatically defines is available in the
section of Chapter 1,
Library Issues
Avoid using Windows 32-bit SDK functions unless you intend your LabWindows/CVI
application to run only under Windows 95/NT.
application to run only under Windows 95/NT.
The
sopen
and
fdopen
functions are available only under Windows. Avoid using them
unless you intend your LabWindows/CVI application to run only under Windows.
Avoid using UNIX host system library calls such as
ioctl
,
fcntl
, and so on, unless you
intend the LabWindows/CVI application to run only under UNIX. Refer to the
00ProRef.book : 06chap06.fm Page 1 Monday, March 9, 1998 3:23 PM