LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Returning Data from DLL to LabVIEW using Pointers

I’m using the call library function to communicate with some third party software.

 

The third party DLL returns data through a sequence of 2 function calls.  A subscribe function and a read function.

 

First you subscribe to the data you want to receive by passing a pointer to a variable that will contain the data.  You can subscribe to many data parameters.

 

Lastly, you call the read function, which publishes all of the data to the variable locations established in the subscribe function.  The read function does not return any values directly.  The data values are returned to the variables though the pointers passed in the subscribe function.

 

Is there any way to have LabVIEW return the data from the read function to some specified locations?

0 Kudos
Message 1 of 5
(3,155 Views)

jsthomas wrote:

I’m using the call library function to communicate with some third party software.

 

The third party DLL returns data through a sequence of 2 function calls.  A subscribe function and a read function.

 

First you subscribe to the data you want to receive by passing a pointer to a variable that will contain the data.  You can subscribe to many data parameters.

 

Lastly, you call the read function, which publishes all of the data to the variable locations established in the subscribe function.  The read function does not return any values directly.  The data values are returned to the variables though the pointers passed in the subscribe function.

 

Is there any way to have LabVIEW return the data from the read function to some specified locations?


You can't really do that in a good way with LabVIEW directly. LabVIEW is dataflow driven, which means its principle is completly against such an interface. There would be very tricky techniques you could make this work from within LabVIEW only but it is really a hack and not really usable for later nor maintainable in any good way.

 

The proper way of operation is to write a wrapper DLL in C or something, that does handle this and returns the data in a more LabVIEW workable way.

 

Rolf Kalbermatter

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 5
(3,139 Views)

I had to handle that kind of ddls before. The point is, that you should not branch the data wire between subscribe and read nor have it go out or into any VI/SubVI. Place a sequence (on of the few cases I find these useful) around Subscribe + read to enforce this behaviour.

 

This is a hack, as Rolf said. What you actually do is to try to avoid LV moving the physical data location of whatever is in that wire.

 

Another hack is using dll calls to the LabVIEW.exe, which offer you some hidden pointer operations. If you go that way, search the forum and you will find some posts by Rolf going into more details.

 

Felix

Message 3 of 5
(3,131 Views)

Thank you Rolf.  I suspected that this wasn't possible.  I will proceed with the wrapper dll.

 

Thank you for the quick reply.

0 Kudos
Message 4 of 5
(3,113 Views)

Thank you Felix for the reply.

0 Kudos
Message 5 of 5
(3,112 Views)