Chapter 4 Windows3.1 Compiler/Linker Issues
©
National Instruments Corporation 4-9 LabWindows/CVI Programmer Reference Manual
Also, you can create a .pth file in the same directory as the .obj or .lib file with the same
base name. The .pth file must contain a simple filename or a full pathname of the DLL. If it
is a simple filename, LabWindows/CVI uses the standard Windows DLL search algorithm.
Rules for the DLL Include File Used to Generate Glue Source
You can generate the DLL glue source file by opening the .h file for the DLL in a Source
window and selecting Generate DLL Glue Source from the Options menu. This command
prompts you for the name of a .h file. It puts the glue code in a .cfile with the same path and
base name as the .h file. You must modify this .c file as this section describes and compile
it using the Watcom compiler. Refer to the Using 32-Bit Watcom Compiled Modules
underWindows 3.1 section of this chapter for information on how to use the Watcom
compiler with LabWindows/CVI.
If any of the functions in the DLL are declared as PASCAL, pascal, or _pascal, you must
declare them as PASCAL in the .h file you use to generate the glue code. LabWindows/CVI
ignores the PASCAL keyword except for the purposes of generating the glue co de . The stub
function in the glue code is not declared as PASCAL. If you include this .h file in the glue
code, the Watcom compiler flags as an error the inconsistency between the declaration of the
function in the .h file and the definition of the stub function. If you include it in other modules
you compile under Watcom, calls to the function erroneously compile as if the function were
PASCAL. You have two options:
Have two s eparate .h files, one that includes the PASCAL keyword and one th at does not.
Use the one that does include the PASCAL keyword to generate the glue code only.
Use conditional compilation so that Watcom ignores the PASCAL macro when it
compiles.
Only use standard ANSIC keywords in the .h file. The keyword PASCAL is the only
exception to this rule. For example, do not use far, near, or huge.
If the DLL Requires a Support Module outside the DLL
Support modules contain special interface functions that the DLL uses but that exist outside
of the DLL. If you are unsure whether the DLL requires a support module, try to build a
project in LabWindows/CVI with the DLL in the project list. If link errors exist in the form
of unresolved references, the DLL requires special interface functions. Get the source code
for the interface functions, add it to the glue code, and compile using the Watcom compiler.
If You Pass Arrays Bigger Than 64 K to the DLL
If you pass the DLL any arrays bigger than 64 K, you must modify the glue code source file.
For example, suppose you have a function in the DLL with the following prototype:
long WriteRealArray (double realArray[], long numElems);
00ProRef.book : 06chap04.fm Page 9 Monday, March 9, 1998 3:23 PM