National Instruments 320685D-01 Drums User Manual


 
Chapter 5 UNIX Compiler/Linker Issues
©
National Instruments Corporation 5-5 LabWindows/CVI Programmer Reference Manual
National Instruments recommends that you always include source code similar to the
following example in your program.
int main(int argc, char *argv[])
{
if (InitCVIRTE(0, argv, 0) == 0) {
return 1;/* Failed to initialize */
}
/* your program code here */
}
If you pass NULL for the second argument to InitCVIRTE, your program might still work,
but with the following limitations:
Your executable cannot accept the
-display command line argument. As a result, you
cannot specify an X display on the command line for your program to use. You still can
use the
DISPLAY environment variable to specify a different X display.
LoadPanel, LoadExternalModule, DisplayImageFile, SavePanelState,
RecallPanelState, and other functions that normally use the directory of the
executable to search for files, use the current working directory instead. If you run the
executable from a directory other than the one that contains your executable, some of
these functions might fail to find files.
Run State Change Callbacks Are Not Available in Executables
When you use a compiled module in LabWindows/CVI, you can arrange for
LabWindows/CVI to notify it of a change in execution status (start, stop, suspend, resume).
You do this through a function called
__RunStateChangeCallback. The Notification of
Changes in Run State section, in Chapter 2, Using Loadable Compiled Modules, describes
this in detail.
The run state change callback capability in LabWindows/CVI is necessary because when you
run a program in the LabWindows/CVI development environment, it executes as part of the
LabWindows/CVI process. When your program terminates, the operating system does not
release resources as it does when a process terminates. LabWindows/CVI releases as many
resources as it can, but your compiled module might have to do more. Also, if the program
suspends for debugging purposes, your compiled module might have to disable interrupts.
When you run a standalone executable, it always executes as a separate process. Thus, the run
state change callback facility is not necessary and does not work. External compilers report
link errors when you define
__RunStateChangeCallback in more than one object file. If
you require a run state change callback in a compiled module that you intend to use both in
LabWindows/CVI and an external compiler, National Instruments recommends that you put
the callback function in a separate source file and create a library (
.a) instead of an object file.
00ProRef.book : 06chap05.fm Page 5 Monday, March 9, 1998 3:23 PM