National Instruments 320685D-01 Drums User Manual


 
Chapter 4 Windows 3.1 Compiler/Linker Issues
©
National Instruments Corporation 4-19 LabWindows/CVI Programmer Reference Manual
cw387 = Get387CW();
retval = (int) InvokeIndirectFunction(__static_g, ptr);
Set387CW(cw387);
return retval;
}
After you make the necessary changes, the code should appear as follows:
/* Assume NUM_ELEMENTS is the number of pointers in the input */
/* array. Assume ITEM_SIZE is the number of bytes pointed */
/* to by each pointer. If you do not know ITEM_SIZE, but you */
/* know that it is 64K or less, you can use 64K as ITEM_SIZE. */
int f(char **ptrs)
{
int retval;
unsigned short cw387;
int i;
char *savedPointers[NUM_ELEMENTS];
/* change the pointers to 16-bit far pointers */
for (i = 0 ; i < NUM_ELEMENTS; i++) {
savedPointers[i] = ptrs[i];
if (Alloc16BitAlias(ptrs[i], ITEM_SIZE, &ptrs[i]) == -1) {
/* failed to allocate an alias; restore */
/* pointers. */
while (i--)
ptrs[i] = savedPointer[i];
return <
error code
>;
}
}
cw387 = Get387CW();
retval = (int) InvokeIndirectFunction(__static_f, ptrs);
Set387CW(cw387);
/* Restore the pointers. */
for (i = 0 ; i < NUM_ELEMENTS; i++) {
Free16BitAlias(ptrs[i], ITEM_SIZE);
ptrs[i] = savedPointers[i];
}
return retval;
}
00ProRef.book : 06chap04.fm Page 19 Monday, March 9, 1998 3:23 PM