Calling a 2D Array LabVIEW DLL in LabWindows™/CVI™

Updated Jun 15, 2018

Reported In


  • LabWindows/CVI

Issue Details

  • How do I call a LabVIEW DLL with a 2D array in LabWindows™/CVI™ or other C development environment?
  • Why am I getting an error saying the CVI 2D array is incompatible with the LabVIEW 2D array DoubleArray type?


Calling a 2D array in LabWindows/CVI is more complicated than calling a 1D array, as it uses pointers and memory allocation. Follow the steps in the example below to call a 2D array.

First, set up the environment to call the LabVIEW DLL by following the instructions in the document Calling a LabVIEW DLL from a LabWindows™/CVI or Other C Project. In your header file, make sure to include the appropriate typedefs, define the function, and allocate memory appropriately, as illustrated by the example below. In this example, the name of the LabVIEW DLL is ArrayTranspose, and it transposes an array of values.

To call the function in main, follow these steps, using the example code below as a reference:
  1. Define the dimension and data of the 2D array
  2. Create DoubleArray to pass the data to the DLL and allocate the size of the array
  3. Dynamically load the array data
  4. Call the DLL by its name and parameters as specified in the header file

This structure will allow you to call a 2D array LabVIEW DLL in LabWindows/CVI successfully. For information on calling other data type LabVIEW DLLs in LabWindows/CVI, see Related Links.


Not Helpful