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

Home » Public Forums » archive » Re: Call_external, IDL v5.5, Fortran and strings
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, IDL v5.5, Fortran and strings [message #34432] Mon, 17 March 2003 13:41
Peter Mason is currently offline  Peter Mason
Messages: 145
Registered: June 1996
Senior Member
Hugh,
I'll suggest a solution in case no-one has sent you a personal reply to your
(unspammed?) email address.

Structures in IDL are automatically padded as necessary to align each field
on its "natural word count". Here's how I think the IDL string structures
actually look in the 32-bit and 64-bit worlds:
32-bit: 64-bit:
length.int32 length.int32
stype.int16 stype.int16
pad.int16 pad.int16
address.int32 address.int64
(12 bytes) (16 bytes)

Now it's been many years since I used Fortran and I don't remember / know
how Fortran handles structure padding. My guess is that it's not doing the
same as IDL. Perhaps it doesn't do any automatic padding? How about
explicitly declaring the "pad" field as above?

Cheers
Peter Mason


"Hugh D. R. Evans" <spam@hevans.xs4all.nl> wrote in message
news:3e723cc9$0$49099$e4fe514c@news.xs4all.nl...
> Hello,
>
> So, I've happily been using some Fortran code interfaced with IDL via
> Call_external. It all used to work beautifully.
>
> Then, and I'm sure someone out there is absolutely over the moon about the
> change, they go in IDL v5.5 and increase the maximum string size to
2**31-1
> bytes. Normally, I'd be happy with such an improvement, but it completly
> breaks the old fortran interface.
>
> I tried to rehack the structure used to hold the meta data for the string,
> i.e.:
> STRUCTURE /string/
> INTEGER*4 slen
> INTEGER*2 stype
> INTEGER s_addr
> ENDSTRUCTURE
>
> which, managed to get me the correct string length again (before it was
just
> 0, as slen was only looking at the top 2 bytes, which were 0). However,
the
> address doesn't seem to be correct - or at least I can't seem to find
> anything remotely resembling the string I passed at the address specified.
>
> Has anyone out there managed to access strings in Fortran via the
> Call_external? An example would be greatly appreciated (esp for a SunOS
> machine - 64 bit version would be nice as well...). The one's provided in
> the $IDL_DIR/external/call_external/Fortran directory don't seem to work
> either.
>
> Regards,
> Hugh
>
>
[Message index]
 
Read Message
Previous Topic: Manipulating data from compiled FORTRAN Code
Next Topic: Re: Manipulating data from compiled FORTRAN Code

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

Current Time: Wed Oct 08 15:28:01 PDT 2025

Total time taken to generate the page: 0.00781 seconds