LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How does call library / .dll file work?

I'm helping someone troubleshoot their machine / LabVIEW program.  I'm fairly new to LabVIEW, and I'm not sure what part of the program is doing.  I've attached the .vi in question.  In the middle of the page there is a sub.vi with a blank icon with two dots in it (peak_detect_dll.vi).  This sub.vi has a call library function node, which I understand calls the file it points to in the config:  s3ilvutils.dll (also attached).  I don't understand what this file does.  I've searched the help and the discussion board.  Can anyone explain to me what this is doing?

 

 

Jeremy Backer
CLAD
Download All
0 Kudos
Message 1 of 8
(3,384 Views)

Hey,

 

Maybe you should ask the one who developed this .dll.

From the inputs and outputs it seems that you pass a signal (as array) and a treshold value in and you get the number of peaks above this treshold and maybe their indices or peak values.

 

Christian

0 Kudos
Message 2 of 8
(3,376 Views)
I cant see your code, but am sure that the CLF node is used to call Dlls in general. If you double-click it to open the configuration window, you can see the function being called. You may need to go through the document that came along with it to know more about the function prototype(s) & its return value. Without these information, it ll be hard to guess what the DLL is capable of doing.
- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 3 of 8
(3,374 Views)

We're unable to get ahold of the person who wrote the code, so I'm on my own here.

 

I know the CLF node calls a dll, and I know what is supposed to happen - it is supposed to tell how many peaks there are in the signal and at what levels.  I want to know how to get into this dll, or how to see exactly what it is doing.  Is the dll written in another language?  I can't open it, my computer says its an unrecognizable extension.  In the configuration of the CLL node, under calling convention, C is selected.  Does this mean the dll is written in C ?

Jeremy Backer
CLAD
0 Kudos
Message 4 of 8
(3,368 Views)

Well I typed too slowly! See that you have a bunch of other answers in the time I took. It was probably written in another language, but dll's can be created in LabVIEW as well. The "C" calling convention only describes a interface convention, doesn't guarantee that C was the language it was developed in, although it probably is a good bet that it was C/C++. I don't think there is an "easy" was to reverse engineer what is in the dll, that is one reasons some functions are put in them, to protect the Intellectual Property, another is to encapsulate a bunch of functionality in a portable block, although yours only has three calls, so that isn't "a bunch".  

 

 

Starting with the "peak_detect_dll.vi": this vi encapsulates a call to the s3livutils.dll, which appears to take a data array from a unit (S3?), pass in this data and parameters for a threshold level and minimum signal width (obviously, the vi's names agree with those of the dll). It returns an array of dbl's, which are apparently the detected peaks above the threshold, and a I32 giving the number of these peaks, which in the highest level vi is not used.  This information can be seen if you right click on the "call library function" in the peak_detect_dll.vi and select "configure".  Dll's are used like for a number of reasons, usually because there is an existing library call, written in another language, or a developer felt that the algorithm used was more efficient than native C. If you right click and select configure you will see (under the pulldown "Function name") that there is additional functionality contained in the dll that may (or may not) be used elsewhere in the program in another dll call.

 

Not sure what exactly you need, but this is just a snippet of code that apparently finds peak values in the input array above some threshold.

 

Message Edited by LV_Pro on 10-19-2009 08:42 AM
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



Message 5 of 8
(3,365 Views)

Thanks LV_Pro.  I was really interested in whether I could get into the code behind the DLL.  Sounds like that's difficult, so I'll probably just rewrite this section in LabVIEW.  What it does isn't that complicated, I just thought it would be nice if I could access it.

 

Thanks everyone.

Jeremy Backer
CLAD
0 Kudos
Message 6 of 8
(3,359 Views)

There are native LabVIEW functions that do peak detection, and are probably darned near as quick as the dll version.

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 8
(3,327 Views)

JMBacker wrote:

Thanks LV_Pro.  I was really interested in whether I could get into the code behind the DLL.  Sounds like that's difficult, so I'll probably just rewrite this section in LabVIEW.  What it does isn't that complicated, I just thought it would be nice if I could access it.

 

Thanks everyone.


It's not only difficult but not really possible. The only thing you can do is disassembly it but that has a few caveats.

 

1) Unless you own the DLL (but then you really should have the source code too), disassembling computer programs is nowadays considered illegal by many juridiscations. 

 

2) Assembly code is just that, a bunch of assembly instructions, and that is a lot harder to read and understand than C source code, which depending on your C proficiency can be a challenge too.

 

3) Going from assembly code to C code is in general not possible automatically. Translating it by hand is a tedious process even for those that have quite a bit of experience in it.

 

4) Last but not least there are Peak Detektion VIs in LabVIEW. Maybe they do the same and best of all they are documented.

Rolf Kalbermatter
My Blog
Message 8 of 8
(3,318 Views)