05-06-2009 04:21 AM
Hi :
I am facing problem using DLL " Cal library function "
i want to define bool connection type to terminals
but i can't see bool type in this cal function . what i see only : Numeric, array, string , waveform,digital data type
how can i define bool " true/ false" ?
. thanks for helping me.
Solved! Go to Solution.
05-06-2009 04:32 AM
Boolean is no ANSI C datatype. Therefore it is not available.
In ANSI C, boolean are normally I8 with the differentiation of value = 0 and value != 0.
If i recall it correctly, FALSE is presented by value = 0.
hope this helps,
Norbert
05-06-2009 05:50 AM
Hi :
if i used digital data type is that as bool
thanks
05-06-2009 09:24 AM
05-07-2009 03:02 AM
smercurio_fc wrote:
That question doesn't make much sense. How is "bool" defined in the C code in the first place? It has to be defined there somewhere. In that case you would use the same datatype.
Well bool is a predefined datatype for C++ (Actually C99 too). But LabVIEW does not know about C++ and its Call Library Node does only allow to call exported standard C functions.
And according to the standard the size of a bool is implementation defined. It says only that its size must be big enough to contain the two values 0 and 1. This would probably mean that a compiler will usually use an 8 bit integer for this but it could just as much use a 32 bit integer or a single bit if the underlaying hardware has support for such variables. So there is no easy way to interface to a function that would use the bool datatype without also knowing what compiler was used to compile that function and what memory size that compiler uses for the bool datatype.
Rolf Kalbermatter