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

Home » Public Forums » archive » IDL-Fortran String/Char Passing
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: IDL-Fortran String/Char Passing [message #1250 is a reply to message #1057] Wed, 16 June 1993 09:41 Go to previous message
Bill Davis is currently offline  Bill Davis
Messages: 4
Registered: June 1993
Junior Member
In article <wicker-150693135755@wicker.tamu.edu> Dr. Louis J. Wicker,
wicker@ariel.tamu.edu writes:
> Hi there. We are doing some idl development which is using some fortran
> routines. Does anyone out there know how to pass character data from idl
> to fortran and vice versa? I know how to do integer and real data, no
> problem. Examples of working code would be VERY welcome.

I do it under VMS. Read all about CALL_EXTERNAL in the User's Guide and
Reference Manual. Passing characters into a FORTRAN routine is no
problem. I must say that it was not trivial to implement returning
strings even after reading the manual. I feel something like the
following example should be included in the documentation:

VMS FORTRAN routine to return a string variable via IDL CALL_EXTERNAL:

INTEGER* 4 FUNCTION retstring ! address pointer is
returned

CHARACTER*16 local_string
CHARACTER*1 null
DATA null /'00'X/

local_string = 'new stuff'//null ! Concatenate null
terminator
retstring = %LOC(local_string) ! Return address of string

RETURN
END

This routine is put into a VMS shared image which is pointed to by the
logical name MY_IMAGE (also non-trivial if you have never done it). Then
in IDL:

strvar=CALL_EXTERNAL(/S_VALUE,'MY_IMAGE','RETSTRING')


This is painfull if you have more than 1 string variable (I believe you
will need one routine per string variable). You may wish to see if using
LINKIMAGE would be easier.
[Message index]
 
Read Message
Read Message
Previous Topic: Problems with double precision in IDL
Next Topic: Mac IDL

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

Current Time: Fri Oct 10 17:23:48 PDT 2025

Total time taken to generate the page: 0.58105 seconds