08-04-2012 02:43 PM
Hi all,
I have a method in my C++ dll as follows.
ER_CODE KMAPI CLSetRankData(DEVICE_HANDLE hDevice, int32_km DataNo, const CL_RANK_DATA* RankData);
where the typedef of CL_RANK_DATA is as follows,
typedef struct tCL_RANK_DATA { CL_RANK_TYPE Type; int8_km RankName[CL_RANK_NAMESIZE_SAVE]; CL_xyDATA xyPoint[CL_RANK_POINTNUM]; CL_TcpduvDATA TcpduvPoint[CL_RANK_POINTNUM]; int32_km PointNum; int32_km Enable; } CL_RANK_DATA;
You can find that I have int8_km in the typedef is a string. How can I construct a LabVIEW cluster which defines this structure? Also notice that I need to pass the pointer of the cluster to the method.
Advance Thanks,
Ajay.
08-05-2012 06:35 PM
@Ajayvignesh MV wrote:
You can find that I have int8_km in the typedef is a string. How can I construct a LabVIEW cluster which defines this structure? Also notice that I need to pass the pointer of the cluster to the method.
Sorry, we can find this where? What is your definition of int8_km?
When you use "Adapt to Type" as the data type in the call library function node setup, clusters are always passed by pointer.
To create a cluster that matches a C struct containing a fixed-size array, create a cluster containing the same number and type of elements as the C array. The easiest way to do this is to wire an empty LabVIEW array of the correct type to "Array to Cluster," set the number of elements to the correct array length, and then create a constant. You may also have to add some padding bytes.
08-16-2012 02:45 AM
The definition of int8_km is char. Though I use "Adapt to type" its not properly parsing the data properly. Finally, I created a wrapper dll for the method. This wrapper dll gets the individual data inside the cluster and bundles it in the "C" environment and sends that Structure's pointer to the original (or main) dll.