11-20-2015 10:15 AM
The question is whether data value application reference is local to application instance, or can be transferred between different applications.
I have a main application that acquires 100 MB array and I need to use these data in a dll. Obviously I do not want to send array, reference would be better. Both applications are built in labview 2011.
The second question is whether data value reference can be converted to string (type cast or flatten to string) and back. For example with DAQmx tasks flatten to string does not work.
Solved! Go to Solution.
11-20-2015 10:34 AM
I'm pretty sure the answer to both of your questions is "no", though I haven't ever tried it to verify.
Have you considered trying to use the Shared Variable Engine instead?
11-20-2015 01:04 PM
Shared variable engine... between applications it means network based shared variables.
Inside main application there is one copy of these data, I did not want extra copies just for sending, client dll just reads data. And installing an extra pretty heavy engine for a simple task of copying data - it is an overkill.
So it will be local UDP or TCP.
11-20-2015 01:30 PM
I looked in to doing something like this awhile ago. The best I could find was this:
http://digital.ni.com/public.nsf/allkb/A1767CAD4B99A3A6862572800067436A
... but it uses network variables.
11-20-2015 01:53 PM
Second question answer is yes, conversion from data value reference to string (flatten and back) works, reference is not lost.
11-20-2015 01:58 PM
Inside the same VI it works, sure. But I don't think it will work between different applications and their respective allocations of memory.
If two different applications are on the same PC and using the shared variable engine, there's no actual network communication going anywhere, it's all localhost, and should be very fast.
11-20-2015 02:43 PM - edited 11-20-2015 02:44 PM
>> Inside the same VI it works, sure.
I was not that sure... it does not work for DAQmx tasks.
>> But I don't think it will work between different applications and their respective allocations of memory.
That is the first question, will take some time to try...
>> If two different applications are on the same PC and using the shared variable engine, there's no actual network communication going anywhere, it's all localhost, and should be very fast.
But it still starts and creates big general service, creates new buffers of data. Does not allow access to portions of data (read only row 1253) without creating an extra copy.
No, no, no. For convenient data transfer between PCs, NI network targets yes, shared variable engine is good, but for local transfer - no... Here NI confirms (aug 2013) SVE is more convenient, but not the best performance way... http://www.ni.com/white-paper/12079/en/
11-21-2015 10:05 AM
@Alexander_Sobolev wrote:
The question is whether data value application reference is local to application instance,
Yes.
or can be transferred between different applications.
No.
The second question is whether data value reference can be converted to string (type cast or flatten to string) and back.
Yes, but reference only means something in the app instance it was created in.
You might wish to give more details about what your actual requirements are, but keep in mind that playing with memory directly in LV is not that simple, as it does everything it can to hide all these details from you.
If you want to pass a pointer to an array to a DLL, you can configure the DLL call to do this. If you want to get the address of a specific LV array in memory and pass that around, this is not something LV supports and you shouldn't do it, because memory should not be controlled by more than one master at any point in time.
LV does have functions for allocating memory and getting the pointer back, but that requires explicit calls.
Anyway, I don't have any real experience with all this. If you want reading materials, there are at least two users here with much more knowledge on the topic and you can go through their posts or search and filter for their posts - rolfk and nathand.
11-21-2015 10:16 PM
11-23-2015 01:15 AM
Is it possible to use these two applications as subVIs in a top level VI? It's much easier to share stuff when they are part of the same application.