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

ページ / 211
Chapter 2
Using Loadable Compiled Modules
LabWindows/CVI Programmer Reference Manual
2-4
©
 National Instruments Corporation
Compiled modules must adhere to the requirements outlined for the target operating 
system. Chapter 3, 
, Chapter 4, 
, and Chapter 5
, of this manual, discuss 
operating system requirements.
Using a Loadable Compiled Module as an External Module 
You can load a compiled module dynamically from your program. A module you load 
dynamically is called an external module. You can load, execute, and unload this external 
module programmatically using 
LoadExternalModule
GetExternalModuleAddr
, and 
UnloadExternalModule
. Refer to Chapter 8, Utility Library, of the LabWindows/CVI 
Standard Libraries Reference Manual for more information on using these functions.
While you develop and debug the external module, you can list it in the project as a source 
file. After you finish debugging the module, you can compile it into an object file or a 
Windows 95/NT DLL. External modules must adhere to the requirements outlined for the 
target operating system. Chapter 3, 
, Chapter 4, 
, and Chapter 5, 
, of this 
manual, discuss operating system requirements.
Notification of Changes in Run State
You might have to notify certain compiled modules whenever your program starts, suspends, 
continues, or stops. For example, if a compiled module has asynchronous callbacks, you must 
prevent the callbacks from executing when program execution suspends at a breakpoint. 
LabWindows/CVI has a callback mechanism you can use to inform a compiled module of 
changes in the program status.
To notify a compiled module of changes in the run state, add a function with the name 
__RunStateChangeCallback
 to the compiled module. LabWindows/CVI automatically 
installs the callback for you.
The run state change callback must be in a compiled file, not in a source file. More than one 
compiled module can contain functions with this name, because LabWindows/CVI never 
enters it into the global name space. The prototype for the callback is as follows:
void CVICALLBACK __RunStateChangeCallback(int action)
libsupp.h
 defines the actions in the following enumerated type:
enum {
  kRunState_Start,
  kRunState_Suspend,
  kRunState_Resume,
  kRunState_AbortingExecution,
  kRunState_Stop,
00ProRef.book : 06chap02.fm  Page 4  Monday, March 9, 1998  3:23 PM