| Re: functions considered as variables [message #11054] |
Wed, 04 March 1998 00:00 |
Andy Loughe
Messages: 174 Registered: November 1995
|
Senior Member |
|
|
gbust@arlut.utexas.edu wrote:
>
> This might be related to my previous post - I don't know. Anyway, I am
> buzzing away, my driver code calling other routines just fine. I have
> compliled a .pro file that has a bunch of routines in it, and all of a sudden,
> I am stopped in my driver routine at:
> junk = getlatlon(alt_gps)
> with the error notice: variable getlatlon not found.
>
> So I do a help, and sure enough it says getlatlon is a function. So, before
> returning to main, i.e. right where the code stopped, I just type the above
> from the command line - and it works fine. What gives?
What version of IDL are you using?
Maybe the getlatlon function could be "compiled" in your startup.pro.
Also, take a look at this paragraph from IDL's on-line help...
------------------
This problem can be eliminated by using the FORWARD_FUNCTION statement.
This statement has the following syntax:
FORWARD_FUNCTION Name1, Name2, ..., NameN
where Name is the name of a function that has not yet been compiled. Any
names declared as forward-defined functions will be interpreted as
functions (instead of as variable names) for the duration of the IDL
session.
For example, we can resolve the ambiguity in the previous example by
adding a FORWARD_FUNCTION definition:
FORWARD_FUNCTION XYZ ;Define XYZ as the name of a
function that has not yet been compiled.
a = XYZ(1, COLOR=1) ;IDL now understands this
statement to be a function call instead of a bad variable reference.
--
Andrew F. Loughe |
afl@cdc.noaa.gov
University of Colorado, CIRES Box 449 |
http://cdc.noaa.gov/~afl
Boulder, CO 80309-0449 | phn:(303)492-0707
fax:(303)497-7013
------------------------------------------------------------ ---------------
"I do not feel obliged to believe that the same God who has endowed us
with
sense, reason, and intellect has intended us to forego their use."
-Galileo
|
|
|
|