Chapter 7 Creating and Distributing Standalone Executables and DLLs
LabWindows/CVI Programmer Reference Manual 7-16
©
National Instruments Corporation
• If you want to force only specific modules from the library into the executable,
reference them statically in your program. For example, you could have an array
of void pointers and initialize them to the names of the necessary symbols.
• If you link in an external compiler under Windows 95/NT, the LabWindows/CVI Utility
library does not know the location of symbols in the externally linked executable or DLL.
Consequently, without further action on your part, you cannot call
GetExternalModuleAddr or RunExternalModule on modules that you link directly
into your executable or DLL. Your alternatives are as follows.
1. Remove the file from the project and distribute it as a separate
.obj, .lib,
or
.dll.
2. Use the Other Symbols section of the External Compiler Support dialog box in
the Build menu of the Project window to create an object module that contains
a table of symbols you want
GetExternalModuleAddr to find. If you use this
method, pass the empty string (
"") to LoadExternalModule as the module
pathname. The empty string indicates that you linked the module directly into
your executable or DLL using an external compiler.
Using LoadExternalModule on Library and Object Files
Not in the Project
If you call LoadExternalModule on a library or object file not in the project, you must keep
the library or object file separate in your distribution.
When you keep an object or library file separate, you can manage memory more efficiently
and replace it without having to replace the executable. For this reason, if you call
LoadExternalModule on a library or object in the project, remove or exclude the file from
the project before you select Create Standalone Executable File or Create Dynamic Link
Library, and then include it as a separate file when you use Create Distribution Kit.
However, remember that you cannot statically reference functions defined in a separate
library or object file from the executable or DLL. You must use
LoadExternalModule and
GetExternalModuleAddr to make such references.
When you distribute the library or object file as a separate file, it is a good idea to place the
file in the same directory as the executable or DLL. If you place the file in the same directory,
you can pass a simple filename to
LoadExternalModule. If you do not want the file to be
in the same directory as your executable, you must pass a pathname to
LoadExternalModule. LoadExternalModule interprets relative pathnames as being
relative to the directory that contains the executable or DLL.
00ProRef.book : 06chap07.fm Page 16 Monday, March 9, 1998 3:23 PM