LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I properly resize labview arrays in external code to insure platform independenced?

I've read the documentation regarding using the labVIEW's array resizing functions to resize arrays that are passed to external code rather than using labVIEW's handle resizing rountines to insure platform independence. Specifically, the documentation notes that different platforms have different double precision alignment requirements (for example). The documentation states that the resize array functions account for these alignment requirement by padding between the int32 array description data and actual array data, while the resize handle routines do not.

What is perplexing is how I should account for unkown padding requirements when using pointers in c. Under Windows, the
typedef for a double precision labVIEW array (exported by labVIEW) is:

typedef struct {
int32 dimSize;
float64 elt[1];
} TD1;
typedef TD1 **TD1Hdl;

How is padding imposed on this structure to insure that elt[] aligns to the boundary requirement for a specific platform?

I've likely missed something in your documentation or something in C, but I don't understand how this structure could possibly be platform independent in the manner described.

Eric
0 Kudos
Message 1 of 3
(2,771 Views)
I presume, having though about this for a few more minutes, if I compile on a soloris machine, the compiler will automatically pad the typedef for the proper alignment requirements. The labview resize array functions take this into consideration when resizing the array... Correct???
0 Kudos
Message 2 of 3
(2,771 Views)
> array... Correct???

Correct. A C compiler gives some amount of control over the alignment
and the projects and makefiles for making CINs and such will help them
to match what LV uses internally.

Greg McKaskle
0 Kudos
Message 3 of 3
(2,771 Views)