From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass a handle to call library function

I am trying to create a LabView interface to a Canon A80 digital camera using the Canon Digital Camera SDK.
One function of the SDK library, "CDEnumDeviceReset" passes a parameter "phEnum". According to the SDK documentation, phEnum has a typedef of cdHandle. Obviously, this type does not exsist in LabView, so I set the parameter type in the Call Library Function dialog box to "Adapt to Type" and wired in an unsigned 32-bit integer. Executing this node works, and an integer is returned from the node. However, if I then call another library function which accepts the same parameter as an argument, I get an error. I seem to be missing something on how to use the Call Library Function...any help is appreciated.
0 Kudos
Message 1 of 3
(2,400 Views)


@bvattiat wrote:
I am trying to create a LabView interface to a Canon A80 digital camera using the Canon Digital Camera SDK.
One function of the SDK library, "CDEnumDeviceReset" passes a parameter "phEnum". According to the SDK documentation, phEnum has a typedef of cdHandle. Obviously, this type does not exsist in LabView, so I set the parameter type in the Call Library Function dialog box to "Adapt to Type" and wired in an unsigned 32-bit integer. Executing this node works, and an integer is returned from the node. However, if I then call another library function which accepts the same parameter as an argument, I get an error. I seem to be missing something on how to use the Call Library Function...any help is appreciated.




The name of the variable indicates that it is a parameter passed by reference (the p in the beginning). Most probably the whole type definition looks like "cdHandle *phEnum". The star indicates a pointer variable (passed by reference).

Rather than use Adapt to type I would explicitedly set the data type to an unsigned long integer (uInt32) and "Pass as Pointer". Your other functions probably accept this handle by value, thus without the star in the type declaration. Configure these parameters as uInt32 too but this time pass them by Value.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
Message 2 of 3
(2,399 Views)
Thanks Rolf, that did the trick, although I'm not sure whether I'm going to be able to access this SDK in a meaningful way in LabView...
0 Kudos
Message 3 of 3
(2,377 Views)