Jump to content

Ralle

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Ralle

  1. 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
  2. Thanks Adam for your great TUT "interfacing a DLL specifically made for LabVIEW". Everything works fine, but If I try to change the new element without Initialising, the DLL throws an error. How can i initialize the new element? Can you give me short example for my application? I have an Array of Clusters with 2 Strings.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.