comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Getting BIG structures into IDL via CALL_EXTERNAL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Getting BIG structures into IDL via CALL_EXTERNAL [message #22543] Wed, 15 November 2000 00:00 Go to next message
Randall Skelton is currently offline  Randall Skelton
Messages: 169
Registered: October 2000
Senior Member
Hello all,

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:

struct atheader
{
/* 8 strings, for a total of 160 bytes */
char runlabl[16], acomment[72], afilter[4], source[12];
char obsloc[12], detector[8], cspare1[32], forrev[4];

/* 30 integers, Bytes 160-279 */
int jspare1[6], dataqual, dataymd, datatape, goddsect;
int aalias, mxpptloc, numint, lastmod, afring, indzpd;
int afftsiz, comgain, afirst, numprim, hdrrno, losamp1;
int losamp2, sclfct, ippver, avgver, ratver, thid, thver, thymd;

/* 50 floats, Bytes 280-479 */
float step, inrelhum, intemp, inpres, spmaxval, rspare1, zpdgmt;
float intsym, phassym, noise, obsalt, solzen, tanht, latitude;
float longtude, tanpres, preserr, gainrat, intfmax, intsumsq;
float spesumsq, specarea, intnoise, spmaxfrq, arzero, spsumval;
float exttemp, extpres, exthum, fovmag, extfov, angmslgn, pointoff;
float scdopp, tplat, tplon, rspare3[14];

/* 4 doubles, Bytes 480-512 */
double lasemfrq, wifact, dspare1[2];
};

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...

Any and all help is greatly appreciated!
Randall
Re: Getting BIG structures into IDL via CALL_EXTERNAL [message #22609 is a reply to message #22543] Tue, 21 November 2000 00:00 Go to previous message
Rob Preece is currently offline  Rob Preece
Messages: 4
Registered: April 2000
Junior Member
In article <U0bR5.170$x3.2484@uchinews>, "Mark Rivers"
<rivers@cars.uchicago.edu> wrote:

> Randall Skelton wrote in message ...
>> Hello all,
>>
>> 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:
>>
>> struct atheader
>> {
>> /* 8 strings, for a total of 160 bytes */
>> char runlabl[16], acomment[72], afilter[4], source[12];
>> char obsloc[12], detector[8], cspare1[32], forrev[4];
> ...
>> 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.
>
> Mark Rivers
>
>

I would second this, and only add that STRINGS should be formatted in
IDL as BYTE arrays. btw, we went over to DLMs recently for our external
code and will never go back to CALL_EXTERNAL.

- Rob


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: filtering problem
Next Topic: Re: n-point FFT

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:48:35 PDT 2025

Total time taken to generate the page: 0.39863 seconds