Admin Production ni-theme
Current Publication

Building a Project in an External Compiler

LabWindows/CVI

Building a Project in an External Compiler

You can build a project you create in LabWindows/CVI in a compiler that generates files of the Common Object File Format (COFF).

Notes
  • To compile code within the LabWindows/CVI environment using an external compiler, specify the compiler in the Active 32-bit compiler or Active 64-bit compiler option in the Build Options dialog box.
  • Static libraries you create in LabWindows/CVI with a debug configuration are not supported outside of LabWindows/CVI.

Complete the following steps to set up the project so that it can be built in an external compiler:

  1. Create a new project in the external compiler. Include in the external compiler project any source files (.c, .lib, and .obj) that the LabWindows/CVI project includes.
  2. In the external compiler project settings, specify the CVIversion\include directory as an include path for the LabWindows/CVI library include files.
  3. If the LabWindows/CVI project includes one or more instrument drivers, add the program files that correspond to those instrument driver files to the external compiler project. Select Instrument»Edit and then click Show Info to display the program file location.

    Also add any program files on which the listed instrument driver depends. Select Edit».FP Auto-Load List to access a list of other instrument drivers on which the current instrument driver depends.
  4. Add the following files from CVIversion\extlib\msvc or CVIversion\extlib\msvc64 to the external compiler project:
    • cvirt.lib
    • cvisupp.lib
    These libraries include the LabWindows/CVI startup library and an import library that contains the User Interface Library, Formatting and I/O Library, RS-232 Library, DDE Support Library, TCP Support Library, Utility Library, and the UDP Support Library.

    The msvc and msvc64 folders in the following directories contain additional files you can add to the external compiler project, depending on the LabWindows/CVI libraries you use in the project.

    • CVIversion\extlib
    • National Instruments\Shared\CVI\Extlib
    • ProgramData\National Instruments\CVIversion\extlib
    Note Note  Import library files for National Instruments hardware libraries might be located in CVIversion\extlib and not within the msvc or msvc64 folders.
  5. Complete this step only if you are building your project in Microsoft Visual Studio 2005 or later. Visual Studio 2005 and later versions do not include support for the single-threaded version of the Visual Studio C library. Therefore, you must configure your project's linker settings to ignore directives to use the single-threaded C library. In Visual Studio, select Project»Properties and expand the properties tree to the Configuration Properties»Linker»Input item. Add libc to the Ignore Specific Library option.
  6. If the LabWindows/CVI project includes .uir files that have callbacks, use the External Compiler Support dialog box to create a .c or .obj file that contains a table of callback functions and function names. Add the generated source or object file to the external compiler project.