Chapter 3 Windows95/NT Compiler/Linker Issues
©
National Instruments Corporation 3-11 LabWindows/CVI Programmer Reference Manual
When you link your program in an external compiler, the external compiler does not make
such a table available to the User Interface Library. To resolve callback references, you must
use LabWindows/CVI to generate an object file that contains the necessary table.
1. Create a LabWindows/CVI project that contains the .uir files your program uses, if you
do not already have one.
2. Select the External Compiler Support command in the Build menu of the Project
window. A dialog box appears.
3. In the UIR Callbacks Object File control, enter the pathname of the object file you want
to generate. When you click on the Create button, LabWindows/CVI generates the
object file with a table that contains the names of all the callback functions referenced in
all the .uir files in the project. When you modify and save any of these .uir files,
LabWindows/CVI regenerates the object file to reflect the changes.
4. Include this object file in the external compiler project you use to create the executable.
5. You must call InitCVIRTE at the beginning of your main or WinMain function. Refer
to the Calling InitCVIRTE and CloseCVIRTE section later in this chapter.
Linking to Callback Functions Not Exported from a DLL
Normally, the User Interface Library searches for callback functions only in the table of
functions in the executable. When you load a panel or menu bar from a DLL, you might want
to link to non-static callback functions the DLL contains, but does not export. You can do this
by calling LoadPanelEx and LoadMenuBarEx. When you pass the DLL module handle to
LoadPanelEx and LoadMenuBarEx, the User Interface Library searches the table of
callback functions the DLL contains before searching the table that the executable contains.
Refer to Chapter 4, User Interface Library Function Reference, of the LabWindows/CVI User
Interface Reference Manual for detailed information on LoadPanelEx and
LoadMenuBarEx.
If you create your DLL in LabWindows/CVI, LabWindows/CVI includes the table of
functions in the DLL automatically. If you create your DLL using an external compiler, you
must generate an object file that contains the necessary table as follows.
1. Create a LabWindows/CVI project that contains the .uir files your DLL loads, if you
do not already have one.
2. Select the External Compiler Support command in the Build menu of the Project
window. A dialog box appears.
3. In the UIR Callbacks Object File control, enter the pathname of the object file you want
to generate. When you click on the Create button, LabWindows/CVI generates the
object file with a table that contains the names of all the callback functions referenced in
all the .uir files in the project. When you modify and save any of these .uir files,
LabWindows/CVI regenerates the object file to reflect the changes.

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