Overview
There are several ways to incorporate LabWindows™/CVI™ functionality into a Visual Studio C++ environment. The appropriate method depends on whether you need to preserve your LabWindows™/CVI™ codebase, align toolchains, or transition fully to a Visual Studio–centric development model.
The primary integration approaches include:
Building a DLL in LabWindows™/CVI™ and Importing into Visual Studio
This approach keeps development centered in LabWindows™/CVI™ . You implement and build your code in CVI, then consume it in Visual Studio.
Workflow
- Develop and maintain the code in LabWindows™/CVI™
- Build the project as a DLL (.dll)
- Generate the corresponding import library (.lib) and header file (.h)
- Include and link these files in your Visual Studio C++ project
For more details on creating DLLs, see the Creating DLLs in LabWindows/CVI article from the LabWindows™/CVI™ User Manual.
Considerations
- This is the most straightforward integration method when keeping LabWindows™/CVI™ as the primary development environment
- It enables clear separation between CVI-built components and Visual Studio applications
- Requires the LabWindows™/CVI™ Run-Time Engine and any dependent NI drivers at runtime
[Back to Overview]
Using an External Compiler in LabWindows™/CVI™ to Align with Visual Studio
This approach ensures that the CVI-built binaries are compiled using the same toolchain as Visual Studio.
Workflow
- Configure LabWindows™/CVI™ to use an external compiler (e.g., Microsoft Visual C++)
- Build the LabWindows™/CVI™ project using this external compiler configuration
- Use the same compiler settings/toolchain in your Visual Studio environment
- Optionally transition the build process fully into Visual Studio using equivalent settings
For configuration details, see the External Compiler Support article from the LabWindows™/CVI™ User Manual.
Considerations
- This approach reduces compatibility issues between LabWindows™/CVI™ and Visual Studio builds
- It provides a smoother path for transitioning build processes into Visual Studio if needed
- Still allows you to leverage LabWindows™/CVI™ during development while aligning binaries with your target environment
[Back to Overview]
Replacing LabWindows™/CVI™ Dependencies with Visual Studio-Compatible Alternatives
This approach avoids direct reuse of CVI-specific code and instead focuses on using APIs and libraries that are fully compatible with Visual Studio.
Workflow
- Identify CVI-specific functionality in your project
- Replace LabWindows™/CVI™ UI components and runtime dependencies with alternatives supported in Visual Studio
- For hardware interaction, use NI-provided C APIs that are compatible with multiple development environments
- Rebuild the application entirely within Visual Studio
Considerations
- This is the preferred approach when standardizing on Visual Studio as the primary development environment
- NI hardware drivers typically expose C APIs that can be used directly in Visual Studio or other C toolchains
- May require refactoring, especially for UI-related or LabWindows™/CVI™ runtime-dependent code
[Back to Overview]
Linking Against Existing LabWindows™/CVI™ Static Libraries
If you already have compiled LabWindows™/CVI™ libraries, or want to reuse shipped libraries, you can link them directly into your Visual Studio project.
Workflow
- Obtain the compiled static library (.lib) from LabWindows™/CVI™ or NI-provided sources
- Include the associated header files
- Link the library in your Visual Studio project settings
Considerations
- This approach is useful when working with prebuilt or distributed libraries
- It avoids rebuilding code while still enabling reuse in Visual Studio
- Ensure compatibility between the library and your Visual Studio compiler settings
[Back to Overview]
Runtime and Dependency Management
Regardless of the selected approach:
- CVI-built components may require the LabWindows™/CVI™ Run-Time Engine
- NI drivers (e.g., NI-DAQmx, NI-VISA) must be installed when used
- Compiler and architecture compatibility (32-bit vs 64-bit) must be verified
[Back to Overview]
Choosing the Right Approach
| Approach | Best For | Key Advantage |
|---|
| CVI-built DLL | Keeping LabWindows™/CVI™ as primary environment | Simplicity and separation |
| External Compiler in CVI | Toolchain alignment | Reduced compatibility risks |
| Replace LabWindows™/CVI™ Dependencies | Full VS migration | Long-term maintainability |
| Static Library Linking | Reusing existing binaries | Minimal rebuild effort |
[Back to Overview]