LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a dll that has an unsigned char, unsigned char * in a function call

I have a dll that has the following function that I am trying to call from LabView

 

GetAvailableData( unsigned short * Num1,   unsigned short * pList,   unsigned short in,   unsigned short * ip  

 

 

In this, the second parameter is an output. When I use call library function node, I  use the second arg to create an indicator. When I run this program, I see the return value to be zero.

 

 I use the following for arg2:

Name: arg2

Type: Numeric

Data type: 16bit Integer

Pass: Pointer to value

 

Any help is appreciated. 

0 Kudos
Message 1 of 4
(3,454 Views)

dinks-

 

           Just some janitorial work first: when posting try and keep the spaces between lines to a minimal. Empty spaces just means less memory somewhere. To your question, I think some clarification is needed. Tell me if this is right, you have a dll that you are calling into LabVIEW using Call Library Function node and then trying to get this unassigned character. It returns 0 but it should be giving something else (what should it be returning?). Are you getting any errors running this or you are just not getting the expected value back? Thanks for the clairfication!!

0 Kudos
Message 2 of 4
(3,424 Views)

dinks-

           Just some janitorial work first: when posting try and keep the spaces between lines to a minimal. Empty spaces just means less memory somewhere. To your question, I think some clarification is needed. Tell me if this is right, you have a dll that you are calling into LabVIEW using Call Library Function node and then trying to get this unassigned character.

 Yes. That is correct. 

It returns 0 but it should be giving something else (what should it be returning?). Are you getting any errors running this or you are just not getting the expected value back? Thanks for the clairfication!!


 

 

Thanks for the response. I think there are lot of nitty gritty details when calling a c++ dll from LabView that I need to learn. The unsigned char problem is solved when I modified the output to Array in Labview.

 

I have issues using C++ functions that return a bool value. 

The other problem is with C++ functions that return a HANDLE.

In the first case where the return value is bool, I assigned the return value in LabView to  Signed 32 bit integer when I call this function,  the return bool value is some large number always irrespective of the C++ bool value (true or false).

 

For the second case (return type HANDLE), I assume, I should specify the return value as signed 32 bit integer in the configure option of call library function node. I tried that and it returns the same value. The dll returns non zero if my hardware that I am interfacing with is found. If it doesn't find the hardware, the return HANDLE is 0. The Labview program returns the same value if I enable the hardware or disable the hardware.

I am following the  Call DLL.vi example for using various data types in C++. 

 

Really appreciate your help.

0 Kudos
Message 3 of 4
(3,419 Views)

dinks-

 

            I think this article will help explain why you can't get your boolean value. There are also links on that article that are VERY beneficial for someone wanting to understand how LabVIEW and dlls interact. Hope this helps!!

0 Kudos
Message 4 of 4
(3,408 Views)