キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

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 件の賞賛
メッセージ1/26
4,094件の閲覧回数

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 件の賞賛
メッセージ2/26
4,087件の閲覧回数
LabVIEW 7 does not support U64.
0 件の賞賛
メッセージ3/26
4,084件の閲覧回数
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 件の賞賛
メッセージ4/26
4,077件の閲覧回数
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 件の賞賛
メッセージ5/26
4,074件の閲覧回数

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

メッセージ6/26
4,070件の閲覧回数
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?
メッセージ7/26
4,068件の閲覧回数
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 件の賞賛
メッセージ8/26
4,038件の閲覧回数
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 件の賞賛
メッセージ9/26
4,019件の閲覧回数
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 件の賞賛
メッセージ10/26
4,002件の閲覧回数