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

ページ / 211
Chapter 2
Using Loadable Compiled Modules
LabWindows/CVI Programmer Reference Manual
2-6
©
 National Instruments Corporation
Example 2 
kRunState_Start
kRunState_EnableCallbacks
/* user program execution begins */
.
.
.
/* a breakpoint or run-time error occurs, or user presses the
   Terminate Execution key combination */
kRunState_DisableCallbacks
kRunState_Suspend
/* program execution suspends; CVI environment resumes */
.
.
.
/* user selects the Terminate Execution command */
kRunState_DisableCallbacks /* even though callbacks already
 disabled */
kRunState_AbortingExecution
/* long jump out of user program */
kRunState_DisableCallbacks /* even though callbacks already 
 disabled */
kRunState_Stop
Note
Resume
 notification does not always follow a 
Suspend
 notification. A
Stop
 
notification can follow a 
Suspend
 notification without an intervening 
Resume
 
notification.
Note
Run state change callbacks do not work if you link your program in an external 
compiler. Also, external compilers report link errors if you have multiple run state 
change callbacks.
Using Run State Change Callbacks in a DLL
You can include one or more run state change callbacks in a DLL. To do so, you must build 
the DLL in the LabWindows/CVI development environment, and each run state change 
callback must be in a separate object or static library file in the DLL project. If you include a 
run state change callback in a DLL, or in an object or static library file that another user might 
include in a DLL, take special care in two areas:
Use caution when you call into other DLLs in response to a 
kRunState_Stop
 message. 
When you use your DLL in a standalone executable, the DLL receives the 
kRunState_Stop
 message when the executable terminates. The order in which 
00ProRef.book : 06chap02.fm  Page 6  Monday, March 9, 1998  3:23 PM