I tried to work with LV 2D double array data in C (dll) via Call Library Node. In the C code, the LV array is a member of a rather complicated cluster array. I have the finall pointer to the required double LV array and I would like to copy the data using memcpy or MoveBlock. (I know the double data size in bytes)
where it is written, that the array contains the size specification at the beginning of the allocated memory. More precisely, 4 bytes for each dimension. In my case of 2D array, the size specification memory block is 8 bytes followed by the double data.
My question is whether the pointer to the array points to the double data or to the beginning of the memory with the size specification.....
If you have created the C source template from the Call Library Node file the answer should be easy.
You end up with something like:
} My2DArrayRec, **My2DArrayHdl;
Looking at this code the answer should be easy.
arr is a pointer to a pointer to the first dimension size!
OK, then arr->elm is points to the first double value in the array
Yes, sort of but that is rather ambigues and most C compilers won't accept that unless you set the warning level to a very low level. arr is not an array pointer but an array handle. So the array index syntax arr[x] never really exists and is strictly speaking invalid. Some C compiler may still allow arr to mean the same as (*arr) but that is very ugly.
I prefer a more descriptive syntax similar to (*arr)->elm.