LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cast U64 Long Long

I am using LabVIEW 7.0 on WinXP interfacing to a DLL. The function returns a *pointer to a U64 (which is cast and in C referred to as Long Long). In LabVIEW 7.0 how would I type cast this?
thanx
 
lmd2
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 1 of 26
(4,021 Views)

Hi Imd2,

i think you can read the value, maybe as an array and use only the 4 bytes you need to create your value.

Mike



Message Edited by MikeS81 on 06-26-2008 04:26 PM
0 Kudos
Message 2 of 26
(4,014 Views)
LabVIEW 7 does not support U64.
0 Kudos
Message 3 of 26
(4,011 Views)
Thanks smercurio_fc,
that´s right. I meant it should be possible to read the U64 value as an array of maybe U8 and use only the values he need to create the number he want.
Mike
0 Kudos
Message 4 of 26
(4,004 Views)
That won't work. In the specification of parameters for the DLL you need to specify the datatype and whether the value is passed by reference or value. If it were passed by reference (i.e., a pointer to a U64) then you could do something. However, it's being passed by value. Specifying the parameter as an 8-byte double might work, since it's the same amount of memory. However, that means you would need to work with the value as a DBL in LabVIEW because there is no U64 in LabVIEW 7.
0 Kudos
Message 5 of 26
(4,001 Views)

Hi,

the function returns a pointer to an U64 value, so i guess you can read the memory as an U8 array with 8 elements.

Mike

Message 6 of 26
(3,997 Views)
Ah, sorry. Missed that from the original post. Was reading too fast.

The only other issue is who is doing the memory allocation. Is the DLL expecting the calling application to pass in a pointer that the DLL uses, or does the DLL allocate the memory?
Message 7 of 26
(3,995 Views)
so the consensus is that I would allocate an array of U8 and then assemble the number on the block diagram from the bytes?
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 8 of 26
(3,965 Views)
Well, you're not going to be able to assemble the number since LabVIEW 7 doesn't support 64-bit integers, as I've already pointed out. You initially said the function returned a pointer to a U64. If you're actually talking about the return value of the function I think you're out of luck, since you're very limited in how you can handle return values. Even in 8.2 you can only select "void", "numeric", and "string". "numeric" allows me to select a return of U64, but not a pointer to it.

So, assuming you were actually talking about one of the function's arguments, I put together a quick and dirty DLL that had a "unsigned long long *" (pointer to U64) in one of its arguments. I stuck with 8.2 since even though I have 7.1.1 installed, at least with 8.2 I could compare with the proper handling via U64. When I called the function using a pointer to a U64 I got the value I was setting in the function. When I tried an array of U8s I didn't get a crash (always a good thing), but the values didn't make any sense. There were 8 of them, as expected, but they bore no resemblance to the actual value, or even to the address of the memory location, so I have no idea what was being output.

I'll try to look at this some more tomorrow.
0 Kudos
Message 9 of 26
(3,946 Views)
Just out of curiosity, what do you need to do with this U64 on the LabVIEW side? Is this supposed to be passed to other DLL functions? Are you supposed to display it somewhere?
0 Kudos
Message 10 of 26
(3,929 Views)