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

Home » Public Forums » archive » Re: CALL_EXTERNAL and structures
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: CALL_EXTERNAL and structures [message #9326 is a reply to message #9325] Mon, 23 June 1997 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <33AE2A0D.481@vision.ee.ethz.ch>, Hubert Rehrauer <rehrauer@vision.ee.ethz.ch> writes:
> Hello,
>
> I got the following problem. I want to call a C function that modifies a
> IDL structure. This works pretty well, except for structure tags that
> have an array-type.
> /*
> IDL input:
>
> $ cc -G -Kpic -c -lm -v idltest.c
> $ ld -G -o idltest.so idltest.o
> a= 5L
> b = DBLARR(4)
> data ={ first: a, second: b }

...

> /* content of the file 'idltest.c' */
> typedef struct {
> long first;
> double * second;
> } data;

The declaration "double * second" is your problem. "second" is not a pointer
to a double, it is an array of doubles, i.e. the array occupies memory
immediately after the long "first", not at a location pointed to by a pointer
after "first". I have not tried it, but I predict that if you change the
declation and code to:

typedef struct {
long first;
double second[4];
} data;
...
d->first = 25;
d->second[0] = 1.4;
d->second[2] =3.8;

that it will work.

____________________________________________________________
Mark Rivers (773) 702-2279 (office)
CARS (773) 702-9951 (secretary)
Univ. of Chicago (773) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars.uchicago.edu (e-mail)

or:
Argonne National Laboratory (630) 252-0422 (office)
Building 434A (630) 252-0405 (lab)
9700 South Cass Avenue (630) 252-1713 (beamline)
Argonne, IL 60439 (630) 252-0443 (FAX)
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Lat/Lon labels ala "gmt"
Next Topic: Re: Bug on IDL 5.0 (VMS 6.2) with alog10()

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

Current Time: Sat Oct 11 10:15:42 PDT 2025

Total time taken to generate the page: 1.68235 seconds