Current Position:Home > How to pass a pointer in labview library call function by using dll programmed in Labwindows​?

How to pass a pointer in labview library call function by using dll programmed in Labwindows​?

Update:12-10Source: network consolidation
I'm trying to interface a camera with Labview.  However, the camera can only be programmed by C, so I'm using Labwindow CVI.
I need to pass a camera handle from one function to another, eg. from a opencamera function to setparameter function.  
/* Load the Qcam driver and Open the First Camera */
void DLLEXPORT LoadDriverAndOpenCamera()
QCam_CamListItem cameraList[10];
unsigned long cameraListLength=sizeof(cameraList)/sizeof(cameraL​ist[0]);
//load the driver
//get a list of the cameras
//listLength is now the number of cameras available
QCam_Handle hCam;
//Open the first camera in the list
QCam_OpenCamera(cameraList[0].cameraId, &hCam);
Apparently, caemraId is an unsigned long (unsigned 32-bit in Labview 2012 32-bit? ) and QCam_Handle is defined as void*, so it's a pointer that points to an unsigned 32-bit.
When I only use C for programming, I can pass hCam variable to other functions as long as it's declared as global variable.  Ex, the next function can be void SetParameter(QCam_Handle hCam).  However, here I'm trying to make a dll by Labwindows/CVI and then call LoadDriverAndOpenCamera() function through library call in Labview.  
My question is:  How can I pass hCam to other functions in the same dll?  Do I have to add paramter to the function? For example:
void DLLEXPORT LoadDriverAndOpenCamera(unsigned long cameraId, QCam_Handle* cameraHandle)
And then add two lines:
into the function?  Then I can pass cameraHandle out?  However, hCam will still have void* type.
Even if that's the case, how can I set up library call node on Labview?  In the arg parameter set up, I don't see pointers?  It seems I cannot set up an output node to be a pointer that points to a unsigned long.
Thank you very much for your help!
Go to Solution.

The Best Answer

Hello Charles, 
I noticed you posted a similar question here. do you have any further questions about using the call library function node? 
Haley N
Applications Engineer
National Instruments