[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting BIG structures into IDL via CALL_EXTERNAL
Randall Skelton wrote in message ...
>I am trying to pass an array of structures (which are very large) into
>IDL. The structure does contains strings; how should I pass them?
>(i.e. do I have to use IDL_STRING and if so, how?) The dimensions and
>format of each structure is:
> /* 8 strings, for a total of 160 bytes */
> char runlabl, acomment, afilter, source;
> char obsloc, detector, cspare1, forrev;
>Has anyone tried to do such a thing? I have it all working very nicely in
>C but I am having some troubles getting the data into IDL. Is it possible
>even to get an array of structures into IDL in one operation? The IDL
>manual does give an example of passing an array into IDL...
This can be done, but you need to be careful about your use of the term
"pass an array of structures into IDL". When using CALL_EXTERNAL you need
to create any variables which will passed from IDL to the library OR
returned from the library to IDL, in IDL prior to the call and pass them to
the C code. Thus, in this case you need to create the array of structures
in IDL, then pass it by reference to the C code. You need to make sure the
IDL structure has the same layout as the C structure, which it generally
will if you are careful with int vs short, etc. There could potentially be
a problem if IDL decided to use difference padding (alignment) in your
structure than C, but I have never found this to be a problem, and I have
done what you are proposing.