Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

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

3 ratings | 3.00 out of 5
Print

Downloads

Filename: call_lv_dll_in_c.zip
Requirements: View

This example illustrates the concept of sharing LabVIEW code by building a shared library (DLL). Specifically, this example demonstrates that you can take advantage of LabVIEW's strengths even if you must program in another environment. Included in this example are C and CVI applications that acquire, analyze, and present data by calling LabVIEW-built DLLs.

Complete the following steps to run the C code.

  1. Open callLVDLL.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. To run the CVI executable, place the LV_AAP.dll, LV_AAP.h, LV_AAP.lib and the CallLVDLLLAAP.uir files in the same directory as the CallLVAAP.exe executable.

Also included in this example is the source code behind the LabVIEW-built DLLs and the buildscript used to create the DLLs. For more information, refer to the "Can LabVIEW C?" document linked below, which compares C and LabVIEW's functionality.

Note When running the application from Microsoft Visual C++ 6.0, you must include the directory containing the LabVIEW support files in the "directories" section of the environment. From the VC++ environment, select Tools»Options»Directories and add the \Program Files\National Instruments\LabVIEW 7.0\cintools directory. This will prevent you from receiving the "Cannot find extcode.h" error.

Software Requirements

LabVIEW 7.0 or LabVIEW 7.0 Evaluation Software is required to view and run the LabVIEW source code behind the DLLs.

Project Files have been included for Microsoft Visual C++ and LabWindows™/CVI™. Download the LabWindows/CVI 7.0 Evaluation Software to run the C code and to try the premium C environment for measurement and automation applications.

The LabWindows/CVI Run Time Engine is required to run the CVI executable.

Related Links

LabWindows/CVI 7.0 Evaluation Software
LabVIEW 7.0 Express Evaluation Software
LabWindows/CVI 7.0 Run Time Engine
Example 3: Using the Right Tools
Can LabVIEW C?

Requirements


Filename: call_lv_dll_in_c.zip

Software Requirements


Application Software: LabVIEW Professional Development System 7.0, LabWindows/CVI Full Development System 7.0
Language(s): C, Visual C++, LabVIEW
Additional Software: Visual C++ 6.0

 
3 ratings | 3.00 out of 5
Print

Reader Comments | Submit a comment »

Project File needed
It would be very helpful to have a LabView 8.20 style *.prj File included
- helmut.urban@eunet.at - Mar 19, 2007

 

Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).