06-28-2008 08:43 AM
06-28-2008 01:56 PM
06-28-2008 02:08 PM
06-29-2008 12:09 PM
Yeah, well, that's not too surprising. They should talk to some of the really experienced LabVIEW developers on this forum. I'm hardly in that league. I suspect their narrow-mindedness would soon evaporate once they see what these folks can do.
@lmd2 wrote:
(some C people tend to talk down to LabVIEW developers)
If you're using the DLL, what exactly are you converting? It seems to me you're just writing a library of accessor functions. The underlying code (DLL) is still C.
What I am working on is converting a client's device driver written in C into a library of VI's.
06-29-2008 12:59 PM - edited 06-29-2008 01:00 PM
Hi Lawrence,
It's certainly possible to bring in the long long as a byte array, and it's possible to convert that byte-array to an EXT.
http://forums.ni.com/attachments/ni/170/297714/1/Util.Time.U64ToEXT.vi
The only tricky part will be LSB/MSB ordering
I'm not sure about reading that DLL parameter as a (pointer to) DBL. Though the DBL is 8 bytes, its binary representation only has a 54-bit mantissa, so you'll loose about 10 bits of precision when doing integer math, However, the EXT has a 64bit mantissa, so can accurately handle the U64.
Cheers!
06-29-2008 11:27 PM
06-30-2008 12:01 AM - edited 06-30-2008 12:10 AM
Hi TonP,
Here's 5 stars for a less complicated solution than mine, (I didn't read your post thoroughly):smileytongue: however, the temporary DBL seems strange - why not just declare the parameter as a pointer to an array of DWORD and loose the need to cast?
Cheers.
06-30-2008 09:08 AM - edited 06-30-2008 09:08 AM
I wasn't actually recommending to do any kind of math with the DBL. The point of using the DBL datatype was to use an 8-byte datatype since 7.0 doesn't have a U64. Last Friday I did a quick DLL that has as one of its arguments a pointer to a U64. In the DLL I set the value of the integer to 8221322035851775305. In 8.2 I called the DLL using a pointer to a U64 and a pointer to a DBL. As you can see, the numerical display of the DBL is wrong, but the interpretation of the value as an array of U8s is the same:
@tbd wrote:
I'm not sure about reading that DLL parameter as a (pointer to) DBL. Though the DBL is 8 bytes, its binary representation only has a 54-bit mantissa, so you'll loose about 10 bits of precision when doing integer math, However, the EXT has a 64bit mantissa, so can accurately handle the U64.
07-05-2008 04:23 AM
smercurio_fc wrote:
The point of using the DBL datatype was to use an 8-byte datatype since 7.0 doesn't have a U64.
That's the part I didn't understand - why expose the 8 bytes as a double - which is useless in 7.0.An array of U32s (instead) can be quickly converted to an EXT
It's still not clear what the user is actually trying to do with this number. Is it being passed to other functions? Is it being used in numerical calculations in a VI? Is it being displayed? I think knowing how it will be used is a factor in determining the best way to do this.
Message Edited by smercurio_fc on 06-30-2008 09:08 AM
07-05-2008 09:15 AM
You are basing this on an assumption of what the user is trying to do. Yes, an array of U32s can be converted to an EXT. But so can a lot of other things. As I've noted several times, it's not completely clear what the user is actually trying to do with this value. To quibble about one specific way being "better" than another is pointless when you don't know what the specific requirements are.
@tbd wrote:
@smercurio_fc wrote:
The point of using the DBL datatype was to use an 8-byte datatype since 7.0 doesn't have a U64.
That's the part I didn't understand - why expose the 8 bytes as a double - which is useless in 7.0.An array of U32s (instead) can be quickly converted to an EXT