LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

create dll with arrays and call it

I am trying to create dll with labview in order to pass a 2d array to the main program. The problem is that I don't really know how to create the function to call it (I don't know much about pointers)

 

The function I have created to call the dll is void Untitled1(TD1Hdl *Array1) which is suposse to return the array created on it.

 

For example, in the program attached, how should I do to pass the array to another program using dlls?

 

Thanks a lot,

 

Juanlu

0 Kudos
Message 1 of 4
(2,409 Views)

At the first - check examples located in the following folder:

 

"%Program Files%\National Instruments\LabVIEW xxxx\examples\dll\data passing"

 

There are lot of examles - how to pass different structures (and arrays) into DLL and back.

I would like to recommend to you to allocate array in LabVIEW and then pass pointer to DLL. Theoretically you can allocate memory in DLL (or resize already allocated memory), but you will need a little bit more experience for this.

 

0 Kudos
Message 2 of 4
(2,395 Views)

The code you've provided doesn't do anything (just a control wired to an indicator) so I'm not sure what you're asking here.

 

If I understand correctly, you want to build a DLL from your LabVIEW VI.  From what language will you call that DLL?  There is no standard way to pass a 2-D array.  If you can convert to a 1-D array, you can use a simple pointer.  With a 2-D array, you're stuck with LabVIEW's array representation (the TD1Hdl type), which means that whatever code calls that function will need to understand the LabVIEW data type and how to manipulate it.

0 Kudos
Message 3 of 4
(2,394 Views)

Hi

 

In continuation to the assumption that your Main Program is also developed in LabVIEW, I would like to know why you wish to pass a 2D array using a dll call?

 

Where is the 2D array coming from? What is the main program doing?

 

Are you willing to try options for passing 2D array of data to the main program without using a dll call?

 

Also, your attachment was in a version higher than what i am using (lv 2010). so could not have a look into your vi.

 

 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 4 of 4
(2,374 Views)