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

ページ / 211
Chapter 5
UNIX Compiler/Linker Issues
©
 National Instruments Corporation
5-3
LabWindows/CVI Programmer Reference Manual
Creating Executables that Use the 
LabWindows/CVI Libraries
You can build executables that use the LabWindows/CVI libraries in two ways:
You can build an executable in the LabWindows/CVI development environment by 
selecting the Create Standalone Executable command in the Build menu of the Project 
window. When you do so, LabWindows/CVI invokes the Sun Solaris linker (
ld
) to link 
your programs to the Run-time Engine shared library. 
You can use an external compiler and linker to create an executable that uses the 
Run-time Engine shared library. Use the Generate Makefile command in the Build menu 
of the Project window to generate a UNIX makefile that corresponds to the currently 
loaded project and libraries. The makefile invokes an external compiler to compile your 
source files, and then it invokes the Sun Solaris linker (
ld
) to link the compiled files with 
the Run-time Engine shared library.
Compatible External Compilers 
You can use the following external ANSI C compilers to compile source files for linking with 
the LabWindows/CVI Run-time Engine shared library.
GNU C Compiler (
gcc
)
Sun C Compiler (
cc
 and 
acc
)
Note
Under Solaris 2.4, when linking the LabWindows/CVI Shared Library with 
external ANSI C compiler, the compiler displays a warning that states the shared 
library has an invalid type. You can ignore this  warning.
Static and Shared Versions of the ANSI C and Other Sun Libraries
When you build a project for execution in the LabWindows/CVI development environment, 
LabWindows/CVI links your program to the static versions of the Sun Solaris libraries 
(
libc.a
 and 
libm.a
). On the other hand, when you create a standalone executable in the 
LabWindows/CVI development environment, LabWindows/CVI invokes the Sun Solaris link 
editor (
ld
) to link your program to the shared versions of the libraries (
libc.so
 and 
libm.so
). Similarly, when you generate a UNIX makefile by invoking the Generate 
Makefile command from the Build Menu of the Project window, the makefile contains linker 
commands to use the shared versions of the libraries.
Thus, when you run your programs as executables, you use a different version of the Sun 
libraries (including the ANSI C library) than when you run them in the LabWindows/CVI 
development environment. Your program might exhibit slightly different behavior as a 
standalone executable than when run in the development environment.
00ProRef.book : 06chap05.fm  Page 3  Monday, March 9, 1998  3:23 PM