Integrating LabWindows™/CVI™ with Microsoft Visual C++

Updated Sep 22, 2023

This article goes through the different options available to use LabWindows/CVI code in a Microsoft Visual Studio C++ project. This article assumes that you have basic C/C++ knowledge to understand the described methods to integrate CVI code into Visual Studio.

For integrating LabWindows/CVI code into Visual Studio there are several options:

1. Build the CVI code into an executable or a DLL and call it from the Visual Studio C++ project. You can read more information about creating DLLs with CVI in the help documentation: Creating DLLs in LabWindows/CVI.

2. Make use of external compilers in CVI to understand how to build (from within CVI at first) the CVI code using Visual Studio's C compiler. Then create a VS project that uses the same commands to build the code. Then create a VS project that uses the same commands to build the code.

3. Refactor CVI programs to remove everything CVI-specific and replace it with alternatives in case of CVI UI or others. For integration with NI HW, usually, there is C API for drivers that can be used from within VS. This step can be less painful if the CVI code is broken into multiple smaller independent projects that can be migrated one at a time and tested gradually.

4. If you plan to use a LabWindows/CVI library directly in a Visual Studio project, you can link the .lib file as a static library. If there are linker errors make sure that Visual Studio is able to locate the header file for the library and that it is using the correct bitness. Please note that in order to use the library you need to install the LabWindows/CVI Run-Time Engine both on the development and deployment computers.