Can you explain me the difference between LabView arrays and C arrays more detailed. A C array of THINGs is a pointer to a THING. The THING is followed in memory by another THING, etc., etc.
There is no difference between a pointer to a THING and an array of THINGs, (except the expectation of the user is that the array contains more than one THING). But physically, they are both pointers to a THING.
In C, if you pass an array to some function which operates on it, you also have to have some convention to separately pass the number of items in the array. The array itself has no way of indicating its own size. A C string is terminated by a null byte - that's one way. Other functions require you to pass a separate parameter to indicate how many elements are in the array.
A LabVIEW array is a different beast. It is a HANDLE, not a pointer. When you resolve the handle, you interpret the first 4 bytes as an I32 with the current dimension size in it. If you have a 2-D array, you interpret the first TWO I32s as the current dimension size. If you have a 3-D array, you interpret the first THREE I32s, etc. etc.
Immediately after the dimension size(s), follows the data itself.
Read this for the official explanation. It's a good idea to print this out and keep it around.
http://zone.ni.com/devzone/conceptd.nsf/webmain/370DFC6FD19B318C86256A33006BFB78?opendocument target=_blank
Why I can't put an array inside a clusterI didn't mean to imply that you can't do that. You can. LabVIEW will handle it correctly. But you can't pass the cluster to C and have it understood, using ordinary C array declarations.
It's legal in LabVIEW to have a cluster with an I32 followed by an array of DBLs, for example.
But if you pass that thing to a DLL or CIN, what gets passed is a pointer to an 8-byte chunk of memory.
The first four bytes are the I32 value. The second four bytes are a HANDLE to the array data. The handle points to a pointer, the pointer points to a chunk of memory, the first four bytes of that chunk are the dimension size.
The bottom line is you can't treat it as an array in LabVIEW, and also as an array in C.
You have three choices:
1... Change the C code to understand LabVIEW arrays. There are lots of library tools to help you deal with LabVIEW arrays.
2... Change the LabVIEW code to fake the structure that C requires. If you have an array of 256 Bytes, you'll have to fake that with a CLUSTER of 256 U8s. If you have an array declared as int[123]. you'll have to make a CLUSTER of 123 I32s. You can make the data fit the C declaration, but you have to study the details.
3... Duplicate the functionality of your C code in LabVIEW.
Hope that helps.