Calling a LabVIEW-built DLL in C to Acquire, Analyze, and Present Data

Publish Date: Aug 19, 2008 | 4 Ratings | 3.50 out of 5 | Print | 1 Customer Review | Submit your review

This example illustrates the concept of sharing LabVIEW code by building a shared library (DLL). Specifically, this example demonstrates that you can reuse LabVIEW code when your main program is written in C. Using this capability, new features and functionality that you create using LabVIEW can easily be added to existing legacy C code. Included in this example are C and LabWindows/CVI applications that acquire, analyze, and present data by calling LabVIEW-built DLLs.

Complete the following steps to run the C code.

  1. Open call LVDLL.c in any C compiler.
  2. Include the LV_AAP.h and LV_AAP.lib files with your project.
  3. Place the LV_AAP.dll file in the same directory as the other files in the project.
  4. Build and run the application (ready to build examples are provided for LabWindows/CVI and Microsoft Visual C++ 2008)
  5. To run the ready-to-run LabWindows/CVI executable, place the LV_AAP.dll, LV_AAP.h, LV_AAP.lib and the CallLVDllAAP.uir files in the same directory as the CallLVDllAAP.exe executable.

Also included in this example is the LabVIEW source code for the DLL and the LabVIEW Project used to create it. This example was written in conjunction with the "Can LabVIEW C? - Example 3: Using the Right Tools with LabVIEW" document linked below, which compares C and LabVIEW's functionality.

Note: When running the application from Microsoft Visual C++ 2008, you must include the directory containing the LabVIEW support files in the "directories" section of the environment. From the VC++ environment, select Tools»Options. Expand the Projects and Solutions section and select VC++ Directories. Select “Include files” in the “Show directories for:” drop down and add the \Program Files\National Instruments\LabVIEW 8.5\cintools directory to the list (replace 8.5 in this file path with your LabVIEW version). This will prevent you from receiving the "Cannot find extcode.h" error.


  • LabVIEW 8.0 or later or LabVIEW Evaluation Software is required to view and run the LabVIEW source code behind the DLLs. LabVIEW Professional Development System 8.0 or higher required to build the DLL.
  • Project Files have been included for Microsoft Visual C++ 2008 and LabWindows™/CVI™. Download the LabWindows/CVI Evaluation Software to run the C code and to try the premier C environment for measurement and automation applications. At a minimum, the LabWindows/CVI Run Time Engine is required to run the CVI executable.
Related Links:
Try LabVIEW online, download LabVIEW or request an evaluation DVD.
LabWindows/CVI Evaluation Software
LabWindows/CVI Run Time Engine
Can LabVIEW C? - Example 3: Using the Right Tools with LabVIEW
Can LabVIEW C? Overview Whitepaper


Back to Top

Customer Reviews
1 Review | Submit your review

Project File needed  - Mar 19, 2007

It would be very helpful to have a LabView 8.20 style *.prj File included

Bookmark & Share







Rate this document

Answered Your Question?
Yes No