Chapter 3 Windows95/NT Compiler/Linker Issues
©
National Instruments Corporation 3-5 LabWindows/CVI Programmer Reference Manual
Choosing Your Compatible Compiler
When installing LabWindows/CVI, you must choose your compatible compiler. If you want
to change your choice of compatible compiler later, you can run the installation program and
change to another compatible compiler.
You can see which compatible compiler is active in LabWindows/CVI by selecting the
Compiler Options command in the Options menu of the Project window.
Object Files, Library Files, and DLL Import Libraries
If you create an object file, library file, or DLL import library in LabWin dows/CVI, you can
use the file only in the current compatible compiler or in a copy of LabWindows/CVI
that you installed with the same compatibility choice. For detailed information on using
LabWindows/CVI-generated object and static library files in external compilers, refer to
the Using LabWindows/CVI Libraries in External Compilers section later in this chapter.
If you load an object file, library file, or DLL import library file in LabWindows/CVI,
you must have created the file in the current compatible compiler or in a copy of
LabWindows/CVI that you installed with the same compatibility choice. If you have
a DLL but you do not have a compatible DLL import library, LabWindows/CVI reports an
error when you attempt to link your project.
To create a compatible import library, you must have an include file that contains the
declarations of all the functions and global variables you want to access from the DLL.
Load the include file into a Source window, and select the Generate DLL Import Library
command in the Optionsmenu.
Make sure the calling conventions of the function declarations in the include file match the
calling convention of the functions in the DLL. Whereas DLLs usually export functions with
the __stdcall calling convention, the __stdcall keyword is sometimes missing from the
function declarations in the associated include files. If you generate an import library from an
include file that does not agree with the calling convention the DLL uses, you can successfully
build a project that contains the import library, but LabWindows/CVI usually reports a general
protection fault when you run the project.
Compatibility Issues in DLLs
In general, you can use a DLL without regard to the compiler you used to create it. Only the
DLL import library must be created for the current compatible compiler. Some cases exist,
however, in which you cannot call a DLL that you created using one compiler from an
executable or DLL that you created using another compiler. If you want to create DLLs that
you can use in different compilers, design the Application Programming Interface (API) for
your DLL to avoid such problems. The following are areas in which the DLLs that external
compilers create are not fully compatible.

00ProRef.book : 06chap03.fm Page 5 Monday, March 9, 1998 3:23 PM