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

ページ / 211
Chapter 7
Creating and Distributing Standalone Executables and DLLs
LabWindows/CVI Programmer Reference Manual
7-18
©
 National Instruments Corporation
current working directory, 
\windows
\windows\system
, then the 
PATH
 environment 
variable.
2.
Look for a 
.dll
 file in the directory of the executable. The 
.dll
 file must have the same 
base name as the file you passed to 
LoadExternalModule
3.
Otherwise, use the standard Windows DLL search algorithm.
If you maintain the DLL glue object module as a separate file from the executable, you must 
pass 
LoadExternalModule
 a pathname to the DLL glue object module, and it uses the 
following search method to find the DLL.
1.
Look for a 
.pth
 file that is in the same directory as the DLL glue object module and that 
has the same base name as the DLL glue object module. If the 
.pth
 file contains an 
absolute path to the DLL, use it to find the DLL. If the 
.pth
 file contains a simple 
filename, use the standard Windows DLL search algorithm.
2.
Look for a 
.dll
 file that is in the same directory as the DLL glue object module and that 
has the same base name as the DLL glue object module. 
3.
Otherwise, use the standard Windows DLL search algorithm.
Note
Before searching for a 
.dll
 file, a standalone executable always looks for a 
.pth
 file. Therefore, your choice of whether to use a 
.pth
  file when you develop 
your application in the LabWindows/CVI environment does not restrict your 
choice of whether to use to 
.pth
 file in the standalone application.
Using LoadExternalModule on Source Files (.c)
If you pass the name of a source file to 
LoadExternalModule
, the source file must be in the 
project. LabWindows/CVI automatically compiles the source file and links it into the 
executable when you select Create Standalone Executable File or Create Dynamic Link 
Library
. For this reason you must pass a simple filename to 
LoadExternalModule
. If you 
use an external compiler, refer to the, 
section earlier in this chapter.
If the source file is an instrument driver program that is not in the project and you link in 
LabWindows/CVI, you have two alternatives:
Add the instrument driver 
.c 
source to the project.
Refer to one of the variables or functions it exports in one of your project files.
If the source file is an instrument program that is not in the project and you link in an external 
compiler, you must create an object file and keep it separate from the executable.
00ProRef.book : 06chap07.fm  Page 18  Monday, March 9, 1998  3:23 PM