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 
Switch to threaded view of this topic Create a new topic Submit Reply
IDL-Fortran String/Char Passing [message #1057] Tue, 15 June 1993 12:01 Go to next message
wicker is currently offline  wicker
Messages: 2
Registered: June 1993
Junior Member
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.

Also, anybody else notice that the new HDF interface in IDL is REALLY slow
as compared to C or Fortran.

Thanks in advance.


| |
| Prof. Louis Wicker email: wicker@ariel.tamu.edu |
| TAMU/Meteorology Dept phone: (409) 845 - 8084 |
| 1204 Eller O&M Bld fax: (409) 826 - 4466 |
| College Station TX 77843-3150 |
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.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problems with double precision in IDL
Next Topic: Mac IDL

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

Current Time: Wed Oct 08 19:40:35 PDT 2025

Total time taken to generate the page: 0.00557 seconds