[V8i MDL] mdlLinkage_extractUsingDescr() and use of a Data Definition Block

When using mdlLinkage_extractUsingDescr() and a Data Definition Block (4th function parameter), I get a return value of  NULL (0), which according to the function documentation means "no linkage was found". I *do* get the linkage converted according to the Data Definition Block returned in the first parameter ( as specified in the documentation), but I suspect the "null" returned in this case doesn't really mean "no linkage found". When looking at some of the examples provided, they name the return value "nextLink", implying what *may* be the true meaning of the "null" returned. Just wondering if anyone can confirm or deny this is the case. When NOT using a Data Definition Block, the returned value IS the pointer to the last element linkage (again, as described in the documentation).

Thanks,

Bruce

Parents
  • Bruce, if you provide a ddbID, you must be sure that only one linkage of that type exists (from the docs: If the caller needs to process multiple linkages in the element, inLinkBufP is set to NULL and a linkFunc function pointer is provided instead. ) The return value should be non-NULL.
    From my experience over the years I avoided to use the ddbID directly, and prefered to always use the callback approach, where I used mdlCnv_bufferFromFileFormat() inside, if necessary. But to be true, most of my links do no longer use predefined structures, but dynamic length data. As I even deal a lot with complex elements, I even prefer to use mdlLinkage_extractFromElement(), to asure extraction from the correct element in the hierarchie. For newer data I almost used XMLFragments, and today would prefer XAttribs at all.



    Answer Verified By: Bruce Reeves SRNS 

  • After re-visiting this issue, I discovered that the example I was using as a guide (circuit) has errors in the "identifyElement()" function. The documentation is indeed correct in that the return value, when null, means no linkage found. The function error was the use of mdlLinkage_extractFromElement() to put the linkage data into the same structure (BatteryLinkage) regardless of the Data Definition Block used, instead of returning the linkage data into the proper structure (WireLinkage from DATADEFID_CIRCUITLINKAGE_WIRE, LightLinkage for DATADEFID_CURCUITLINKAGE_LIGHT, and BatteryLinkage for DATADEFID_CIRCUITLINKAGE_BATTERY).

Reply
  • After re-visiting this issue, I discovered that the example I was using as a guide (circuit) has errors in the "identifyElement()" function. The documentation is indeed correct in that the return value, when null, means no linkage found. The function error was the use of mdlLinkage_extractFromElement() to put the linkage data into the same structure (BatteryLinkage) regardless of the Data Definition Block used, instead of returning the linkage data into the proper structure (WireLinkage from DATADEFID_CIRCUITLINKAGE_WIRE, LightLinkage for DATADEFID_CURCUITLINKAGE_LIGHT, and BatteryLinkage for DATADEFID_CIRCUITLINKAGE_BATTERY).

Children
No Data