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

Document Type: Example Program
NI Supported: Yes
Publish Date: Aug 2, 2007

Calling LabVIEW DLL in Visual C++ That Passes Array Handles by Reference

1 ratings | 1.00 out of 5
Print

Overview

This example demonstrates the syntax necessary for passing array handles between an external coding environment and a shared library (DLL) you create in LabVIEW.

Downloads

Filename: array_handle_passing.zip
Requirements: View

Array_Multiply.vi has an input array and an output array. The VI generates the output array by multiplying each element of the input array by two. A build script, Build Array_Multiply.bld, builds the VI into a shared library that passes these parameters as array handle pointers. Array_Multiply.lib and Array_Multiply.h are the library and header files that the build creates.

The Call Array_Multiply DLL folder contains the files for the workspace of the same name, as well as the Array_Multiply.dll. The main code of the project allocates memory for the handle pointers and initializes the arrays to which they point.

Note: To make the example as simple as possible, each array contains only one element.

Print statements write the value of the first element of the output array to a console before and after a call to the shared library. You will see that the call to the shared library changes the value of the output array.

Note: You might need to reattach labview.lib to the project. You can find this file in the labview\cintools directory.

Requirements


Filename: array_handle_passing.zip

Software Requirements


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

 
1 ratings | 1.00 out of 5
Print

Reader Comments | Submit a comment »

 

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/).