Re: stupid question about CALL_EXTERNAL [message #3689] |
Sun, 05 March 1995 14:29 |
rivers
Messages: 228 Registered: March 1991
|
Senior Member |
|
|
In article <3jdb1s$dkr@larry.rice.edu>, vek@spacsun.rice.edu (Vincent E. Kargatis) writes:
> I'd like to use a FORTRAN program/subroutine that returns four values. My
> reading of CALL_EXTERNAL seems to indicate that it will only pass one value
> back to IDL. How do I get all four? Do I have to call four different
> mini-programs, each calling the subroutine and returning one of the values?
> (Surely not!) Hopefully there is a suitably obvious answer to what is
> probably a stupid question...
> --
CALL_EXTERNAL can pass back only one value as its function value (just like
C or Fortran), but it can pass back any number of values which are passed to it
as parameters. If you want to do this, you must make sure you pass IDL
variables of the correct type and you must not pass expressions.
For example, this will work
a = 0. ; A float
b = 1 ; A short
c = 2L ; A long
t = call_external(XXX, YYY, a, b, c)
but this won't
t = call_external(XXX, YYY, float(a), fix(b), long(c))
The latter will work fine if the values you are passing are only inputs to your
FORTRAN routine, but it won't work if they are outputs.
____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
|
|
|