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

ページ / 211
Chapter 5
UNIX Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual
5-2
©
 National Instruments Corporation
Using Shared Libraries in LabWindows/CVI
In the LabWindows/CVI development environment, you can link your programs to static 
libraries, but not to shared libraries. If you have to use a shared library, you must use the Sun 
Solaris linker (
ld
) to build your application. Refer to th
 section later in this chapter for more information on using 
external compilers and the Sun linker.
If you have both shared and static versions of a library, you can develop and debug your 
application in the LabWindows/CVI development environment using the static version of the 
library. You can then create your final executable with the Sun linker using the shared version 
of the library. 
Using dlopen
The Sun Solaris 
dlopen
 function allows you to load shared libraries from your program 
dynamically. Although this function can work in some cases when running in 
LabWindows/CVI, it can make LabWindows/CVI unstable. If you use 
dlopen
 to load shared 
libraries in a program you run in LabWindows/CVI, the shared libraries might link to the 
system libraries the LabWindows/CVI environment uses. As a result, functions in the shared 
library might modify the LabWindows/CVI environment and cause unpredictable behavior.
The LabWindows/CVI Run-Time Engine 
as a Shared Library
The LabWindows/CVI development environment contains many built-in libraries such as the 
User Interface Library and Utility Library. LabWindows/CVI also provides these libraries in 
the form of a standalone shared library called the LabWindows/CVI Run-time Engine. All 
executables that call LabWindows/CVI library functions use the Run-time Engine shared 
library. This is true whether you build the executable in the LabWindows/CVI development 
environment or with an external compiler and the Sun Solaris linker.
00ProRef.book : 06chap05.fm  Page 2  Monday, March 9, 1998  3:23 PM