Chapter 4 Windows3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual 4-4
©
National Instruments Corporation
You must observe certain rules and restrictions in a DLL you want to use with
LabWindows/CVI. If you experience problems using a DLL in LabWindows/CVI,
you might have to contact the developer of the DLL to obtain modifications.
Because LabWindows/CVI is a 32-bit application, special glue code is required to
communicate with a 16-bit DLL. For some DLLs, LabWindows/CVI can automatically
generate this glue code from the include file when loading the DLL. For other DLLs, you
have to modify the glue source code and compile it with Watcom into a .obj or .lib file.
The normal way of communicating with a DLL is by calling functions in the DLL. However,
cases exist where you must use other communication methods. The most typical case is that
of an interrupt service routine in a DLL that notifies the application when an interrupt occurs.
This is done through a callback function. Also, LabWindows/CVI can recognize messages
posted by a DLL through the Windows Application Programming Interface (API) function
PostMessage and initiate a callback function.
Helpful LabWindows/CVI Options for Working with DLLs
LabWindows/CVI provides two options that can be helpful when working with DLLs. The
options can be found in the Run Options menu of the Project window:
Enable the Check Disk Dates Before Each Run option when you iteratively modify a
DLL or DLL glue code file and run a LabWindows/CVI test program that calls into the
DLL. By enabling the Check Disk Dates Before Each Run option, you ensure that you
link the most recent version of the DLL and DLL glue code into your program. You can
leave this option enabled at all times. The only penalty is a small delay each time you
build or run the project.
By default, LabWindows/CVI does not unload and relo ad DLLs between each execution
of your program. This eliminates the delay in reloading the DLLs before each run. It
allows the DLLs to retain state information between each run. If, however, you use a DLL
that does not work correctly across multiple program executions, enable the Reload
DLLs Before Each Run option.
DLL Rules and Restrictions
To call into a 16-bit DLL from LabWindo ws/CVI 32-bit code, you m ust observe the foll owing
rules and restrictions for DLL functions:
In the DLL header file, change all references to int into references to short.
In the DLL header file, change all references to unsigned or unsigned int to
unsigned short.
You can declare the functions in the DLL as PASCAL or as CDECL.
You cannot use variable argument functions.

00ProRef.book : 06chap04.fm Page 4 Monday, March 9, 1998 3:23 PM