LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can you use datasocket within a dll

I'd like to make a dll from labview that has some functions that include datasocket writes and reads, where the dll would be used by a C program (being developed by our subcontractor) to talk to our existing Labview applications. This was the simplest solution to my situation arrived at after a phone call with an application engineer in Austin last week. It seems to me, however, that DataSocket server drops writes from a process that isn't Labview (or some other NI product, perhaps.) Can you confirm this? I came to this theory after creating the attached project.

There are several items in this: "read test.vi" just loops forever watching for a change in the example data that I hope to write. "F_to_C.vi" is from NI's posted ex
ample on how to create dlls with labview and call them from C - except I have added a dataSocket write inside, and I pass out the error code from this.
The visual C++ project is a console application where I try giving the temperature at the command line, and call the dll as usual.

What I observe is that if F_to_C.vi is run as a vi, the data changes when read by the reader vi.

If the console application is run, I see a the number of processes connected increase at DataSocket Server window. I see the number of packets there increase also. I see my temperature get converted properly by the dll. I see a proper error code that DataSocket Write would generate (either 0 if data socket server is running, or 63 if it isn't). The only thing I don't see is the data actually change in the reader vi. If I go back and run the original temperature conversion vi, I see that the reader.vi is still working.

The other vi in the folder (F_to_C2.vi) is where I've taken the dll that was created
by labview, and then reuse it back in labview. The dll works 100% when used in this way.
0 Kudos
Message 1 of 5
(3,106 Views)
I took a look at your code and I am not sure if I understand the issue, or if maybe I am not seeing the same behavior. I ran the Read Test VI, and then I ran your application and it updated the value in the VI. Is there something that I am doing wrong?
0 Kudos
Message 2 of 5
(3,105 Views)
Hello,
 
so I've also problems using Datasockets within a DLL.
 
My problem ist a litte bit different. I have written a SubVI making a Datasocket Write or Read to a variable (dstp://localhost/test). Now if I run
this VI within LabView it works fine. But if I export the VI and build a DLL every time I call the DLL function I get an error 56 network error.
 
So my question is where ist the mistake?
 
Can someone give me an working example on how to use Datasockets within a DLL!
 
Thanks,
 
Gerald
0 Kudos
Message 3 of 5
(2,962 Views)

hi there

i've seen that to:

http://forums.ni.com/ni/board/message?board.id=170&message.id=184899&query.id=0#M184899

i havn't found a solution by now, sorry.

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 5
(2,957 Views)

hi there,

it seems to work when you create the DSTP-connection outside the dll and pass it as a parameter. i closed the connection outside the dll too.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 5
(2,951 Views)