LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to creat a pointer with various size?

I need to creat a pointer in labview. this pointer was define as "unsigned short" in the original C code and it is to define a buffer. the pointer must be of the size of the buffer(512*512*n, where n is an integer number the user controls) and it must points to the beginning of the the buffer. How would I do that?

Thanks in advance!

kevin
Can a computer learn how to program?
0 Kudos
Message 1 of 3
(2,415 Views)
kevin,

You don't exactly (get to/have to) play with pointers in LabVIEW. However, you can call a dll that requires such a pointer as long as LabVIEW is responsible for the associated memory.

You can use 'Call Library Function' from the Advanced palette to interface to the dll. I've only done this a few times myself and am no expert on the needed calling convention, but if you poke around a bit you'll at least see an option for passing an array as a pointer. Note: your LabVIEW code never gets to see or use this pointer directly.

Assuming that your unsigned short is 16 bits, you would simply use 'Initialize Array' to create a 512x512xn array of u16's. Then you'd pass this array into 'Call Library Function.' Yes, you'll be filling your array with initial values in LabVIEW only to have your dll function re-fill it with the real values. I don't know any way around that.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 3
(2,406 Views)
Thanks Kevin. That certainly runs without error, it might just solve my problem, thank you again.

Kevin Y
Can a computer learn how to program?
0 Kudos
Message 3 of 3
(2,390 Views)