Coyote's Guide to IDL Programming

Size of an IDL Structure Variable

QUESTION: How can I determine the size or length of an IDL structure variable in bytes?

ANSWER: This functionality, oddly enough, is provided by the N_Tags function and the Length keyword.

   structSize = N_Tags(myStructure, /Length)

The length or size of a structure is machine dependent and depends upon the host machine. IDL pads and aligns structures in a manner consistent with the host machine's C compiler.

If you want the actual length of the data (without padding bytes), use the Data_Length keyword. The data length of any given structure will be the same on every machine architecture.

Web Coyote's Guide to IDL Programming