National Instruments 320685D-01 ユーザーズマニュアル

ページ / 211
Chapter 4
Windows 3.1 Compiler/Linker Issues
LabWindows/CVI Programmer Reference Manual
4-8
©
 National Instruments Corporation
DLLs That Can Use Glue Code Generated at Load Time 
If your DLL can use glue code generated at load time, LabWindows/CVI automatically 
generates the glue code based on the contents of the 
.h
 file it associates with the DLL when 
it loads it. 
Any functions declared as 
PASCAL
pascal
, or 
_pascal
 in the DLL should be declared as 
PASCAL
 in the 
.h
 file. LabWindows/CVI ignores the 
PASCAL
 keyword except when 
generating the glue code.
Use only standard ANSI C keywords in the 
.h
 file. (The keyword 
PASCAL
 is the only 
exception to this rule.) For example, do not use 
far
near
, or 
huge
.
Note
You can create an object module that contains the glue code. If you do so, 
LabWindows/CVI can load the DLL faster because it does not have to regenerate 
and recompile the glue code. To create the object module, load the 
.h
 file into a 
Source window and select Options»Generate DLL Glue Object. If the DLL 
pathname is listed in the project, replace it with the object module file. If the DLL 
is not listed in the project, but is associated with a 
.fp
 file, make sure the object 
module is in the same directory as the 
.fp
 file. 
DLLs That Cannot Use Glue Code Generated at Load Time 
If your DLL cannot use glue code generated at load time, you must generate a glue code 
source file from the DLL include file using the Generate DLL Glue Source command from 
the Options menu of a Source window. You must then compile the glue code using the 
Watcom compiler to create a 
.obj
 or 
.lib
 file to be loaded with the DLL. If you also have 
interface functions that must exist outside the DLL, you must combine them with the glue 
code to form the 
.obj
 or 
.lib
 file.
Loading a DLL That Cannot Use Glue Code Generated 
at Load Time 
If you have a 32-bit Watcom compiled 
.obj
 or 
.lib
 file that contains glue code for a DLL, 
LabWindows/CVI must load the 
.obj
 or 
.lib
 file first. For instance, if you want to use 
x.dll
 and 
x.obj
 in your program, add 
x.obj
 to the project. Do not add 
x.dll
 to the 
project. The 
.obj
 or 
.lib
 file causes LabWindows/CVI to load the 
.dll
.
The 
.obj
 or 
.lib
 file must contain the glue code for the DLL. It is the presence of the glue 
code that indicates to LabWindows/CVI that a 
.dll
 is associated with the 
.obj
 or 
.lib
file. 
When LabWindows/CVI loads the 
.obj
 or 
.lib
 file and finds that it contains glue code, it 
first looks for the 
.dll
 in the same directory as the 
.obj
 or 
.lib
 file. If it cannot find 
the
.dll
, LabWindows/CVI looks for it using the standard Windows DLL search algorithm.
00ProRef.book : 06chap04.fm  Page 8  Monday, March 9, 1998  3:23 PM