From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What's equivalent data type I can use to link to the variable to Boolean Input for dll written in C language?

I used Labview "Call Library By  Node" to link a function namely A function from a dll written in C language. The A function prototype as below:

 

 

I16 __stdcall A(U16 X1, UCHAR X2, UCHAR X3,BOOLEAN *X4, BOOLEAN *X5, U16 *X6, U32 *X7);

 

There's no boolean type for me to assign to X4 and X5 variable. Please help.

 

0 Kudos
Message 1 of 5
(2,099 Views)

Hi

 

you can use the 'Adatpt to Type' setting as current parameter type, in the dll function prototype and wire a boolean constant on the input of the terminal.

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 2 of 5
(2,096 Views)

If I used "Adapt To Type", then what's the data format I should use? There are options "Handles by Value", "Pointer to Handles", "Array Data Pointer" and "Interface to Data".

0 Kudos
Message 3 of 5
(2,087 Views)

Hi

 

I missed one thing in your original post, that the dll function has boolean pointers. since i have not worked with pointers as dll parameters, i cannot tell you which one is the correct option.

 

but, i would play around with the available options and see which one works.

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 4 of 5
(2,080 Views)

The "Adapt to Type" suggestion makes this more complicated than necessary.  Just replace it with a byte (which happens to be how LabVIEW represents a boolean as well), per the Windows Data Types documentation.  Note that in Windows, BOOL and BOOLEAN are different sizes (thanks, Microsoft!).

 

EDIT: in case it wasn't obvious, since your function parameters are pointers, the appropriate LabVIEW configuration is a U8 (or I8) passed by reference.

0 Kudos
Message 5 of 5
(2,077 Views)