National Instruments 320685D-01 Drums User Manual


 
Chapter 4 Windows 3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual 4-6
©
National Instruments Corporation
regs.x.si = HIWORD(size);
int86(0x31, &regs, &regs);
return regs.x.cflag;
}
After the DMA is complete, you must unlock the buffer. You can unlock the buffer using
the
DPMILock function, if you set regs.x.ax to 0x601, instead of 0x600.
If you compile the DLL with the
/FPi or /FPc switches or with no /FP switches
(
/FPi is the default), the DLL uses the WIN87EM.DLL floating point emulator.
LabWindows/CVI does not use
WIN87EM.DLL. If the DLL uses WIN87EM.DLL, use the
following strategy in the DLL to prevent conflicts:
1. Structure the code so that all functions that perform any floating-point math have
known entry and exit points. Ideally, specify a particular set of exported entry
points as the only ways into the floating-point code.
2. Call the Windows SDK function
FPInit in each of these entry points. Store the
previous signal handler in a function pointer.
3. If the DLL has its own exception handler, call
signal to register the DLL’s own
signal handler.
4. Perform the floating-point math.
5. Upon exiting through one of the well-defined DLL exit points, call the Windows
SDK function
FPTerm to restore the previous exception handler and terminate
the DLL’s use of
WIN87EM.DLL.
typedef void (*LPFNSIGNALPROC) (int, int);
/* prototypes for functions in WIN87EM.d11 */
LPFNSIGNALPROC PASCAL_FPInit (void);
VOID PASCAL_FPTerm (LPFNSIGNALPROC);
void DllFunction (void)
{
LPFNSIGNALPROC OldFPHandler;
/* save the floating point state, and setup the */
/* floating point exception handler for this DLL. */
OldFPHandler = _FPInit ();
signal ( SIGFPE, DLLsFPEHandler); /* optional */
.
.
.
00ProRef.book : 06chap04.fm Page 6 Monday, March 9, 1998 3:23 PM