LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Q re returning data to LV via pointer to DLL

Hello,

I have a LabView 7.0 program that calls a shared library written in C and compiled using LabWindows/CVI 7.0.

The DLL returns results to me by writing them into memory that I provide from LabView. In LabView, I wire a control to the input side of the shared library node, and I pass that value by pointer.

The DLL does not actually use the value, but rather uses the pointer to write a value that I will later need in LabView.

My question is... why do I need to connect the output side of the library node to a local variable instance of the original input control? I've found that if I don't make this connection, then I don't get the desired value written by the DLL to the specified memory location!

This seem
s very strange to me. Since the DLL is changing the value at its memory location, I would not expect to need to wire anything to the output of the shared library node. Can anyone explain this behaviour?

Thanks in advance,
Frenk
0 Kudos
Message 1 of 2
(2,306 Views)
Frenk wrote:

> Hello,
>
> I have a LabView 7.0 program that calls a shared library written in C
> and compiled using LabWindows/CVI 7.0.
>
> The DLL returns results to me by writing them into memory that I
> provide from LabView. In LabView, I wire a control to the input side
> of the shared library node, and I pass that value by pointer.
>
> The DLL does not actually use the value, but rather uses the pointer
> to write a value that I will later need in LabView.
>
> My question is... why do I need to connect the output side of the
> library node to a local variable instance of the original input
> control? I've found that if I don't make this connection, then I don't
> get the desired value written by the DLL to the specified memory
> location!

Repeat wit
h me: LabVIEW is dataflow, and everything in LabVIEW is
dataflow centric.

The wire coming from the control is NOT the control itself. The wire
itself is the variable and once read from the control has no association
with that control anymore. So you pass a pointer to that array or string
to the DLL, the DLL fills in whatever it wants and then you have a new
wire on the right side of the Call Library Node containing that value.
No connection to the control at all anymore. You will have to connect
the wire coming out of the Call Library Node to an indicator (well the
local variable of the control works too, but isn't a very functional
solution) to make it visible on the frontpanel.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 2
(2,306 Views)