LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading a DLL from two VIs

Hello everyone,

I  have a problem with tthe follwing task:

I need to create an application where two different VIs exchange data through a base VI that is saved as a DLL.

The data I want to exchange is a simple string. VI 1 should write the data into the DLL and VI 2 should read it.

I can create a DLL from the base VI, but when trying to send data through, nothing happens.

 

Can somebody help me with this?

 

I simply don't understand the explanations in the LabView help, as for example the button to select a method (c-String handle, Pointer to String) is explained, but not the methods.

0 Kudos
Message 1 of 5
(2,972 Views)

Hey,

 

Why don't you use a functional global variable instead of dll?

 

 

Christian

0 Kudos
Message 2 of 5
(2,969 Views)

Hi Christian,

the problem is that the DLL will be in the future also be accessed from other platforms than Labview. So I need to work with a DLL. Using a global would help me for now, but unfortunately not for the future task.

0 Kudos
Message 3 of 5
(2,967 Views)

Using a DLL for data exchange doesn't sound like a reasonable approach. Depending on what your setup, mutliple things could happen, e. g. the applications call their own instances of the DLL which don't share the same memory space or the DLL doesn't stay in memory all the time... If you don't know exactly which threads are used and how the memory allocation is done I wouldn't count on that as a reliable communication channel. What about using standard communication channels like TCP/IP or OPC?

 

Regards,

Jochen

0 Kudos
Message 4 of 5
(2,939 Views)

rpweber wrote:

Hi Christian,

the problem is that the DLL will be in the future also be accessed from other platforms than Labview. So I need to work with a DLL. Using a global would help me for now, but unfortunately not for the future task.


This will not work. A DLL instantiated by application X can not look into the data of the same DLL instantiated by application Y. Each application has its own private heap and the DLL will use this application private heap to store its information. So data sharing between applications through DLLs is doomed.

 

Use shared variables, shared memory, or inter application communication through TCP/IP for that.

Message Edited by rolfk on 10-30-2009 03:53 PM
Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 5
(2,921 Views)