National Instruments 320685D-01 Drums User Manual


 
Chapter 4 Windows 3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual 4-12
©
National Instruments Corporation
long ClearAsyncWrite (void)
{
/* because this does no floating point, you can remove */
/* the cw387 code */
long retval;
retval = (long) InvokeIndirectFunction(__static_ClearAsyncWrite);
if (!IsError (retval)) /* replace with macro to check if */
/* retval is error */
if (gAsyncWriteAlias != 0) {
Free16BitAlias (gAsyncWriteAlias,gAsyncWriteSize);
gAsyncWriteAlias = 0;
gAsyncWriteSize = 0;
}
return retval;
}
You can terminate LabWindows/CVI programs in the middle of execution and then re-run
them. When you terminate the program, you should also terminate the asynchronous I/O. You
can arrange to be notified of changes in the run state by including a function with the name
RunStateChangeCallback in the .obj or .lib file associated with the DLL. You can add
this function to the glue code file. Refer to the Notification of Changes in Run State section
of Chapter 2, Using Loadable Compiled Modules, of this manual for a complete description
of the run state change notification. In the example we have been discussing, you should add
the following code.
#include "libsupp.h"
void CVICALLBACK __RunStateChangeCallback (int newState)
{
if (newState == kRunState_Stop)
ClearAsyncWrite ();
}
If the DLL Calls Directly Back into 32-Bit Code
If the DLL calls directly back into 32-bit code, you must modify the glue code source file.
You can call functions defined in 32-bit source code directly from a DLL. Although this
method is not as straightforward as Windows messaging, it is not subject to the latencies of
Window messaging. For more information about Windows messaging, refer to the
Recognizing Windows Messages Passed from a DLL section of this chapter.
Note
If you need direct callbacks to occur at interrupt time because the latency of
Windows messaging is interfering with your application, contact National
Instruments for assistance.
00ProRef.book : 06chap04.fm Page 12 Monday, March 9, 1998 3:23 PM