LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Can Project1 read Variables from Project2 by placing them in the same Workspace? If not possible, how can I accomplish it?

> I have 2 projects that run separately
> Project1 wants to read a variable from Project2
> The variable in Project2 is in a Numeric Indicator
> How can Project1 read the value from Project2 ?

> If I put both Projects in the same Workspace
Will this do the trick?

thank you...

\\carlos_diaz
0 Kudos
Message 1 of 4
(3,149 Views)
For this kind of interapplication communication, I would recommend using DataSocket. Assuming you have DataSocket installed on your machine, you should be able to run the following two projects: 1) writer.prj and 2) reader.prj. You'll find them in the "\samples\datasocket" directory.
Through DataSocket (which uses TCP/IP and ActiveX technology), the Writer connects to the DataSocket server launched on your machine. The Writer sends data to the server that can be retrieved by any allowed client. The data can be a single number, a list of numbers or other supported data types.
The Reader will connect to the server and read this information live (i.e., as it is being generated by the Writer) and display it on its user interface.
So there you have it. Tw
o projects that share information, without worrying about variable's memory space or even synchronization. DataSocket takes care of all the details for you.

If you are not familiar with DataSocket, I'd suggest you check out our Developer Zone site and search for DataSocket examples, white papers, etc.

Regards,

Azucena
NI
0 Kudos
Message 2 of 4
(3,149 Views)
> Data Socket will probably solve my problem. Thankyou.

> The question still remains, If I put both CVI
projects in the same workspace, can one Project
read the other one's variables?

thanks again,

\\carlos_diaz
0 Kudos
Message 3 of 4
(3,149 Views)
No, they won't be able to "see each other" because they are in totally different memory spaces. The fact that both projects are in the same workspace is irrelevant since workspaces are just a way to organize and group several projects, nothing else.
The only way project A can access the project B's variables, it's if project A is an executable and project B is a DLL which exports such variables. Then at runtime project A loads up the DLL and access the variables.

Regards,

Azucena
0 Kudos
Message 4 of 4
(3,149 Views)