This is the code:
typedef struct { LStrHandle SerialNumber; LStrHandle ModelName; LStrHandle FullName; LStrHandle VendorName; LStrHandle DeviceClass; LStrHandle DeviceVersion; LStrHandle UserDefinedName; } CamInfoCluster;typedef struct { int32_t_Dilas dimSize; CamInfoCluster CamInfo[1]; } CamInfoArray;typedef CamInfoArray **CamInfoArrayHdl;//DT1Hdltypedef struct { LVBoolean status; int32_t_Dilas code; LStrHandle source; } ErrorCluster;void EnumerateCameras(CamInfoArrayHdl CamArray, ErrorCluster *LVError){ int numDevicesAvail; char* String; numDevicesAvail = 3; int deviceIndex; MgErr err = mgNoErr; if( mgNoErr == (err = DSSetHSzClr(CamArray, Offset(CamInfoArray, CamInfo) + sizeof(CamInfoCluster)*numDevicesAvail)) ) { (*CamArray)->dimSize = numDevicesAvail; //Initialize new elements????? (Example please) } else { FillErrorCluster(LVError, TRUE, mFullErr, "mFullErr"); return; } for ( deviceIndex = 0; deviceIndex < numDevicesAvail; ++deviceIndex ) { String = "Serial"; //SerialNumber (*((*(CamArray))->CamInfo[deviceIndex].SerialNumber))->cnt = strlen(String); NumericArrayResize(uB, 1, (UHandle*)(&((*(CamArray))->CamInfo[deviceIndex].SerialNumber)), 4 + (*((*(CamArray))->CamInfo[deviceIndex].SerialNumber))->cnt); strncpy((char*)(*((*(CamArray))->CamInfo[deviceIndex].SerialNumber))->str, String, (*((*(CamArray))->CamInfo[deviceIndex].SerialNumber))->cnt); } }void FillErrorCluster(ErrorCluster *LVError, LVBoolean bStatus, int iCode,char* cSource){ LVError->status = bStatus; LVError->code = iCode; (*(LVError->source))->cnt = strlen(cSource); NumericArrayResize(uB, 1, (UHandle*)(&(LVError->source)), 4 + (*(LVError->source))->cnt); strncpy((char*)(*(LVError->source))->str, cSource, (*(LVError->source))->cnt);}
The incoming Array can be empty!
LV Error:
Possible reason(s):
LabVIEW: An exception occurred within the external code called by a Call Library Function Node. The exception may have corrupted LabVIEW's memory. Save any work to a new location and restart LabVIEW