LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a dll fio labview

I have a sncore sensor and the API files I gopt from the company are below.

I am unable to call them inside labview. The error I get is usually

 

" One or more required inputs to this function are not wired or are wired incorrectly. Show the Context Help window to see what the connections to this function should be."

 

I am attachning the sencore API files I have.

0 Kudos
Message 1 of 12
(3,551 Views)
Well, you've included what appears to be a C-based application that uses some DLL, but no LabVIEW code, so I don't know what it is that you want us to look at. I'm assuming the DLL that you're trying to access is PodAPI.dll. If that's the case you've got a bigger issue. The main PodConnect function returns a pointer to a structure. You can do a search on all the issues with trying to do this in LabVIEW or just read the executive summary: you will need to create a wrapper DLL that allows you to pass basic datatypes to/from LabVIEW. However, if you don't intend to access this structure, and just want to call the half-dozen functions then you can prbably just treat this return value as a U32 and simply pass it to the other functions.
0 Kudos
Message 2 of 12
(3,540 Views)

thanks for your quick response smercurio_fc. Yes I need to acces the PodAPI.dll.

i didnot get what you said earlier like the wrapper dll. My labview knowledge is limited.

My question also is do I need to use VISA to communicte with my device. I am very

confused regarding this issue. Also let us say if I want to call only function for example

BOOL PodGetRGBValue(HPOD *port,float *Red,float *Green,float *Blue) then what data type should I choose, as

there is no float in call library functions.

0 Kudos
Message 3 of 12
(3,520 Views)

You would not use VISA since you have a DLL. VISA and the use of a DLL are mutually exclusive.

 

A wrapper DLL is a DLL that you would write to act as a go-between between LabVIEW and another DLL. This is required under certain situations. In the PodAPI DLL there are 5 functions. The function to connect to the device is PodConnect. This returns a pointer to a structure which is quite complicated - it has arrays, and pointers to other structures. You can't create a compatible datatype in LabVIEW to be able to access this structure's elements. Thus, if you needed to change one of the parameters of this structure you would need to create a wrapper DLL that locally holds in memory the pointer to the structure and exposes functions that allow LabVIEW to modify the individual parameters. These functions would use simple datatypes. If you don't need to change any of the structure's parameters then you may be able to simply treat the return value of this function as just an integer, because that's all that a pointer is. You can then pass this integer to the other functions which require a pointer to an HPOD structure. If all of this sounds like gobbledigook, then you have a larger problem in that you don't know what DLLs are.

 

As for the "float" question, that's just a DBL datatype in LabVIEW. 

 

Having said all that, the PodAPI DLL does not appear to be a C DLL. At least, I cannot get a list of functions from it using the Call Library Function Node. I even tried using Dependency Walker. Are you sure it's a C DLL?

Message 4 of 12
(3,507 Views)

smercurio_fc, The API files and sample application are written in C++. I think it should work

in labview or will I face problems. I am trying to take a proper look at the code and see whatever

I can understand from it. Let know if u stumble on anything else.

 

thanks for your time 

0 Kudos
Message 5 of 12
(3,489 Views)
LabVIEW cannot call C++ DLLs. It only handles C DLLs. If the DLL is a C++ DLL then you will need to write a wrapper DLL or see if the vendor can give you a C DLL.
Message 6 of 12
(3,483 Views)

smercurio is right about the PodConnect() function returning a structure pointer but it is not clear if that is a problem here. If you do need to access any of the values in that structure directly then yes you have a problem. If you can live with only calling the 5 or so functions exported by that DLL (as is done in the SampleApp included in that archive), without a need to look into the HPOD structure yourself at some point then you can simply treat that HPOD * datatype as a pointer sized integer, passed by value.

 

Basically everywhere you see the HPOD * datatype you configure the according parameter in the Call LibraryNode to be a pointer sized integer.

 

If you however find out that you need to look into the values stored in that structure directly then yes you do need to write a wrapper DLL, that exports more convenient functions for LabVIEW to get at that data.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
Message 7 of 12
(3,469 Views)

Can anyone create a sample to call any function from the dll files I gave.

The examples i have been searching are also not very useful. thanks

guys for u rhelp.

0 Kudos
Message 8 of 12
(3,433 Views)
Actually, I had already tried to do that. Unfortunately, no functions are listed when the DLL is selected, which is why I don't think it's a C DLL.
0 Kudos
Message 9 of 12
(3,431 Views)

smercurio_fc you have ben of incredible help to me, thanks. When I search

in Ni developer zone or in simply google, many mention that C++

could be called from labview. I donot know, I will dig more into this

tonight. You also said that one could create a wrapper if I want to use dll,

 there are some examples but none had clarity. If you have any examples

which could give me a proper idea. 

 

Also if I have a C dll where to I see all the list of functions when I select

it my Call library function node as you said. Are you using the call-Lib-func node

or trying to import them from the library.

0 Kudos
Message 10 of 12
(3,425 Views)