05-20-2009 02:45 PM
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?
05-20-2009 05:34 PM
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
05-20-2009 09:34 PM
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
05-21-2009 07:25 AM
Thank you Rolf. I suspected that this wasn't possible. I will proceed with the wrapper dll.
Thank you for the quick reply.
05-21-2009 07:26 AM
Thank you Felix for the reply.