National Instruments 320685D-01 Drums User Manual


 
Chapter 7 Creating and Distributing Standalone Executables and DLLs
©
National Instruments Corporation 7-17 LabWindows/CVI Programmer Reference Manual
Using LoadExternalModule on DLL Files under Windows 95/NT
Under Windows 95/NT, you cannot pass the pathname of a DLL directly into
LoadExternalModule. Instead, you must pass the pathname of a DLL import library. You
can link the import library into your executable or DLL or distribute it separately and load it
dynamically. For import libraries that you link into your executable or DLL, refer to the Using
LoadExternalModule on Files in the Project section earlier in this chapter. For import
libraries that you load dynamically, refer to the Using LoadExternalModule on Library and
Object Files Not in the Project section earlier in this chapter.
You must always distribute DLLs as separate files. The operating system finds the DLL
associated with the loaded import library using the standard Windows DLL search algorithm.
The search precedence is as follows.
1. The directory from which the application loads
2. The current working directory
3. Under Windows 95, the Windows
system directory. Under Windows NT, the Windows
system32 and system directories
4. The Windows directory
5. The directories the
PATH environment variable lists
Using LoadExternalModule on DLL and Path Files
under Windows 3.1
DLL files and DLL path files are never linked into the executable, so you must distribute them
as separate files.
Your executable can call
LoadExternalModule directly on a DLL or DLL path file only if
you include the DLL or DLL path file in the project. When you select Create Standalone
Executable File, LabWindows/CVI automatically creates the DLL glue code and links it into
the executable.
Also, you can pass the DLL glue object module filename to
LoadExternalModule. You can
generate the DLL glue object module by opening the
.h file for the DLL in a Source window
of LabWindows/CVI and selecting Generate DLL Glue Object from the Options menu.
If you include the DLL, the DLL path file, or the DLL glue object module as a file in the
project, you must pass
LoadExternalModule a simple filename, and it uses the following
search method to find the DLL.
1. Look for a
.pth file in the directory of the executable. The .pth file must have the same
base name as the file you passed to
LoadExternalModule. If the .pth file contains an
absolute path to the DLL, use that path to find the DLL. If the
.pth file contains a simple
filename, use the standard Windows DLL search algorithm: directory of executables,
00ProRef.book : 06chap07.fm Page 17 Monday, March 9, 1998 3:23 PM