National Instruments 320685D-01 Drums User Manual


 
Chapter 4 Windows 3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual 4-10
©
National Instruments Corporation
In the glue code generated by LabWindows/CVI, there is a declaration of WriteRealArray
like that shown in the following example.
long WriteRealArray (double realArray[], long numElems)
{
long retval;
unsigned short cw387;
cw387 = Get387CW();
retval = (long)
InvokeIndirectFunction (__static_WriteRealArray, realArray,
numElems);
Set387CW (cw387);
return retval;
}
Note
The lines of code referencing cw387 are necessary only if the DLL function
performs floating point operations. They are innocuous and execute quickly, so
LabWindows/CVI adds them to the glue code automatically. If the DLL function
does not perform floating point operations, you can remove these lines.
If
realArray can be greater than 64 K, you must modify the interface routine as shown.
long WriteRealArray (double realArray[], long numElems)
{
long retval;
unsigned short cw387;
DWORD size;
DWORD alias;
size = numElems * sizeof(double);
if (Alloc16BitAlias (realArray, size, &alias) <0)
return <
error code
>;
cw387 = Get387CW();
retval = (long)
InvokeIndirectFunction (__static_WriteRealArray, alias,
numElems);
Set387CW (cw387);
Free16BitAlias (alias, size);
return retval;
}
00ProRef.book : 06chap04.fm Page 10 Monday, March 9, 1998 3:23 PM