LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to pass an opened file reference from one labview application to another

Hello there,

 

I have a labview application (exe) and a labview shared library (dll). both running in parallel and have some functions in common. they do not call/know each other. the exe is running stand alone and the dll is called from c++.

 

I need to share data between those 2 instances and usualy do this with networked shared variables. but for some reason i cannot create a networked shared variables of type "byte stream file reference". but i need to accomplish that when a file is opened with dll function then the labview exe can write to this file.

 

any ideas?

 

regards

Thomas


- Thomas -
0 Kudos
Message 1 of 5
(2,815 Views)

My instinctive response is: Dont. Let one set of functions handle file operations. I think it's hard to pass file ref, you'll have to pass filename and possibly file position.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 5
(2,801 Views)

I can only agree to what Yamaeda said: Dont try to do that!

 

When you need to access a File form two different Application Instances you will need to Open (and therefore create the File Reference) the File in both Instances.Since both Instances run in pararel we are dealing with a shared Resource. This may lead to Race Conditions. You wont be able to tell who is accessing or writing data. You may be able to overcome this with additional synchronisation but it aint elegant.

 

Why dont you try the following aproach:

 

One Instance does all the File I/O and you only transmit the Data that has to be written or read?

Message 3 of 5
(2,779 Views)

I understand your interventions, but my requirements are more simpler. I only need to open a file in both Exe or DLL. But only exe writes to file. None is reading. I need to be able to write to a file in exe which is opened in DLL. I will use the following ugly approach now: In exe i make a loop which checks some network shared string variable which represents a filename. From DLL i can change that string which the exe then will notice and open the new file.


- Thomas -
0 Kudos
Message 4 of 5
(2,772 Views)

If only exe is writing and none is reading, then the DLL only need the path. 🙂

Create or look for some "set path"-function. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 5
(2,763 Views)