LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get my camera handle from a void pointer?

My Point Grey Research Dragonfly camera uses a type called "context" that is defined as void*. This value is passed to and from the various functions in their dll as a handle to the camera. How do I create a variable of type void* to send to a dll function call as an input parameter? Some kind of refnum would be way cool so that I can use this parameter as a true reference for the camera instance, creating and destroying with the Point Grey "createContext" and "destroyContext" functions.
jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 1 of 5
(2,894 Views)
A pointer is a variable with the length of 32 bit. So you can use a U32 data type to hold the handle in LabVIEW. If you get the handle from createContext as output you can use it in other functions of the DLL. Wire the output to the input of the functions. You can do with it as with all other U32 wires. Be aware that LabVIEW cannot use the pointer since it dosn't have such data type. You can't retrieve the data to which the pointer points in LabVIEW.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 5
(2,894 Views)
It sounds like in this case you don't want to use the returned handle directly in LabView: you just want to pass it to the next DLL call for your camera. Using U32 should work fine.
On a more general note (not applicable to this case), LabView can use pointers as parameters to and from the Call Library Node function. When you're configuring the Call Library Function node, for any parameter other than the return variable, there will be a pull-down list box labeled Pass, where you can select Value or Pointer to Value (for numerics). In your diagram, you don't treat the wires to and from the Call Library Function node as pointers, just as numbers. The conversion from value to pointer and back happen within the Call Library Function node. You can use a local
variable to initialize the parameter (and pointer).
0 Kudos
Message 3 of 5
(2,894 Views)
Precisely what I needed to know. Thanks.
jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 4 of 5
(2,894 Views)
Thanks for the added comment Al S. The creation function passes a pointer to the "context" and the rest of the functions use the value of "context", which as I mentioned is a void pointer. It looked impossibly strange to someone unfamiliar with c-code. It all seems so simple now. I really appreciate you guys (you and Waldemar) taking the time to answer my question. Things are starting to work in this code, now.
jc
Mac 10.4
LV7.1
CLD
0 Kudos
Message 5 of 5
(2,894 Views)