05-12-2016 01:43 AM
hi
i am new to use dll calling in labview,i am trying to send created memory for an array(unsigned short) of few elements in labview and send that address to the dll ,
in dll i am trying to fill data to the array by giving some delay for each element .
I got the total array in labview after competion of dll exicution only .
my doubt is
is this possible to get array data in labview whenever data placed by dll in that address before dll exicution complted ?
thanks in advance.
Solved! Go to Solution.
05-12-2016 03:46 AM
LabVIEW is a data flow programmings language. One of its foundational principles is that a node has to finish before the output wires get data (which enables following nodes to operate).
Hence the node "Call Library Function Node" has to finish before you receive back the modified array.
Norbert
PS: There might be some option to do what you want, but if they do work at all, your DLL and the LV code will get way more complex compared to what you have right now.
05-12-2016 07:23 AM
thanks for reply .
yes you are right but for my requirement i need that and we are passing the array address from labview to dll so i just want to know is there any methode to derefrence parallelly .
05-12-2016 08:53 AM - edited 05-12-2016 08:54 AM
@anil06 wrote:thanks for reply .
yes you are right but for my requirement i need that and we are passing the array address from labview to dll so i just want to know is there any methode to derefrence parallelly .
Well, the memory layout of LabVIEW arrays is fully documented so yes you can reference a LabVIEW array in the C DLL.
But doing it parallel to execution in the LabVIEW diagram is NOT a viable option since LabVIEW controls the lifetime of all its data dynamically and the pointer you pass into the DLL is only guaranteed to exist for this particular instance until your Call Library Node returns to the diagram. After that LabVIEW reserves the right to resize, modify, reuse or entirely deallocate the array whenever it feels like that would be useful. There is no reliable way to tell LabVIEW that the data array is still referenced in the DLL and that it needs to treat this data block as being locked.
If you need to have data blocks available in the background while your DLL already returned control to the LabVIEW diagram you have to manage that data block on your own by creating it, managing it, filling it and eventually copying its contents into a LabVIEW data array. Nothing else will work reliably!