LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running DLL under LV7 is slower than 6.0.2?

I'm calling a DLL from LabVIEW and I noticed that under LabVIEW 7 express this dll runs 2x slower than under LabVIEW 6.0.2. Any clues ?
The machine is a Dell Dimension 4400 2GHz Windows XP.
0 Kudos
Message 1 of 8
(3,208 Views)
Can you attach a really simple VI and dll that shows this? If you can make a simple dll that shows this it may be worth sending it to NI so that they can take a look at it.

What does your actual dll do and what was it written in? When you have loaded the VIs that call the dll in 7.0, did you mass compile the VIs so that they are all 7.0 VIs?
0 Kudos
Message 2 of 8
(3,208 Views)
I am having the same problem, only with a CIN node which is fairly similar. No problem running it in LabVIEW 6.0.2 but in 7.0 "Express" the whole VI runs slow, because of the CIN node. I did the mass compile and everything, to no avail. any advice will be appreciated.
0 Kudos
Message 3 of 8
(3,208 Views)
Nevermind, found the answer. The CIN node wasn't declared to be "thread-safe" which caused the poor performance. All I had to do was add a snippet of code into my source code and the VI works like new. The code is available in the "Using External Code with LabVIEW" manual.
0 Kudos
Message 4 of 8
(3,208 Views)
Do you think this solution works the same for calling external dlls ?
0 Kudos
Message 5 of 8
(3,208 Views)
> Do you think this solution works the same for calling external dlls ?

CINs do this via a function call. DLLs designate the one and only
function that you want to have called, so there is a node setting in the
dialog. Double click on the Call Library Function node and change the
checkbox. This will also change the node's color from orange to yellow.
This color indication is a hint for the setting for CINs and DLL nodes.

Greg McKaskle
0 Kudos
Message 6 of 8
(3,208 Views)
Dear Greg

Thank you for the advice,I changed the function call as reentrant and it increases the performance almost 3 times better.

Ricardo
0 Kudos
Message 7 of 8
(3,208 Views)
> Thank you for the advice,I changed the function call as reentrant and
> it increases the performance almost 3 times better.
>

Just to make sure you know what this changes. When a DLL is marked as
reentrant, LV will call it in the thread that is executing. This may
not be the same thread from call to call, and if you have the DLL call
in multiple locations, including in a reentrant subVI, the DLL may be
called by multiple threads simultaneously. Some DLL functions are OK
with this, others are not and may crash or return wrong results. This
is why the safe setting is not reentrant. If you are sure the the code
is reentrant or protected, or is called only once in your application,
then it is fine to swit
ch it over, and you will avoid some overhead of
thread switching. If you start seeing odd results or crashes, this is a
likely cause and the first thing to do is mark your DLLs as not
reentrant and see if this fixes the problem.

Greg McKaskle
0 Kudos
Message 8 of 8
(3,208 Views)