Chapter 4 Windows3.1 Compiler/Linker Issues
©
National Instruments Corporation 4-11 LabWindows/CVI Programmer Reference Manual
You must also modify the call to GetIndirectFunctionHandle for WriteRealArray as
shown in the following code:
if (!(__static_WriteRealArray = GetIndirectFunctionHandle
(fp, INDIR_PTR, INDIR_WORD, INDIR_ENDLIST)))
by changing INDIR_PTR to INDIR_DWORD.
If the DLL Retains a Buffer after the Function Returns (an Asynchronous Operation)
If the DLL retains a buffer after the function returns, you must modify the glue code source
file. Suppose two functions exist. WriteRealArrayAsync operates just like
WriteRealArray, except that it returns before it completes writing the real array.
ClearAsyncWrite terminates the asynchronous I/O. The glue code interface functions for
WriteRealArrayAsync and ClearAsyncWrite should be modified to resemble the
following example.
static DWORD gAsyncWriteAlias, gAsyncWriteSize;
long WriteRealArrayAsync (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_WriteRealArrayAsync, alias,
numElems);
Set387CW (cw387);
if (IsError (retval)) /* replace with macro to check if */
/* retval is error */
Free16BitAlias (alias, size);
else {
gAsyncWriteAlias = alias;
gAsyncWriteSize = size;
}
return retval;
}
00ProRef.book : 06chap04.fm Page 11 Monday, March 9, 1998 3:23 PM