03-17-2015 05:12 AM - edited 03-17-2015 05:17 AM
Hi All,
I getting an exception when calling a c++ dll which has PostLVUserEvent to trigger the LabVIEW event structure.
This dll has typedef stuct as described below (nested structure type), the same data structure is sent using PostLVUserEvent to the LabVIEW event.
typedef struct abc { utf8_t *name; uint32_t numChildren; struct abc *children; } abc;
Please help me to create a nested structure cluster in LabVIEW. I am creating a cluster as shown below:
Sorry if this post is repeated.
Thank in advance
03-17-2015 06:38 AM - edited 03-17-2015 06:47 AM
This is not the datatype of a LabVIEW structure as you depict it!
The data structure would be something like this in C syntax:
typedef struct abc { LStrHandle name; uint32_t numChildren; struct children
{
LStrHandle name;
uint32_t numChildren;
} children;
} abc;
So the name is a LabVIEW string handle and has to be allocated, resized and deallocated using LabVIEW memory manager functions and the struct is not an array pointer but simply embedded. If it was an array in the LabVIEW cluster it would be really a LabVIEW array handle too.
Simplified it would really be equal in memory layout to this:
typedef struct abc { LStrHandle name; uint32_t numChildren1; LStrHandle name; uint32_t numChildren2; } abc;
Generally what you seem to want to do is a pretty bad idea. Managing LabVIEW arrays and strings on C level is quite a hassle, combining it with a recursively defined data structure is simply going to be a major pita. In fact you can't define fully recursive data structures in LabVIEW. The data type graph would end up being an infinite type description and that will blow up every memory immediately.