Re: HELP: IDL Function/Variable Problem [message #5172] |
Mon, 16 October 1995 00:00 |
thompson
Messages: 584 Registered: August 1991
|
Senior Member |
|
|
hrebhan@awi-bremerhaven.de (Helge Rebhan) writes:
> Be sure that the function CASPER_BORESIGHT is compiled *before* any
> reference to it. Otherwise a default variable is created.
I'm not sure that this is entirely true. I believe that it is sufficient if
the function is in the IDL search path !PATH. Presuming, of course, that it's
in a file called casper_boresight.pro. I almost never use .RUN directly.
Instead I put each procedure or function in a .pro file of the same name and
depend on IDL to automatically compile it for me.
One problem that I have run into is that if one has a function reference that
uses a keyword, and that function is not in the path, and one tries to compile
a procedure referencing that function, then IDL generates an error. IDL
apparently goes through the following steps when it sees something that might
be a function, going through each step until a match is found:
1. Checks to see if that function has already been compiled.
2. Looks for a .pro file of the same name in the current directory or
in !PATH.
3. Assumes that it's a variable instead of a function.
The problem is that if step 3 is reached, but the function call uses a keyword,
then a syntax error is generated.
Bill Thompson
|
|
|
Re: HELP: IDL Function/Variable Problem [message #5179 is a reply to message #5172] |
Fri, 13 October 1995 00:00  |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
Thomas A McGlynn <tam> wrote:
>>
> It's not sufficient that you compile a function before you use it, you
> must compile the function before you compile any reference to it. E.g.,
> if you compile the main program then compile the function then execute
> the main program, you'll get an undefined variable error. You need
> to compile function, compile main, run main. Depending upon how your
> functions call one another and how they are distributed amongst the .PRO
> files, it may be impossible to run a program without compiling some
> of your modules twice. Of course that probably indicates that
> you need to restructure your code...
> Tom McGlynn
Not guilty in this case.
The function is compiled before any reference to it.
Still looking into it...
Tim
|
|
|
Re: HELP: IDL Function/Variable Problem [message #5183 is a reply to message #5179] |
Fri, 13 October 1995 00:00  |
hrebhan
Messages: 10 Registered: January 1995
|
Junior Member |
|
|
In article <45k85r$10e@newsstand.cit.cornell.edu> Tim Patterson <tgp4@cornell.edu> writes:
Hallo,
> I have a large IDL/FORTRAN/C program that seems to have suddenly
> developed a strange bug. All IDL routines are compiled and then
> the main program is run. However, when a certain widget button
> is pressed and the program goes into the event handler, it
> complains that one of my pre-compiled functions "CASPER_BORESIGHT"
> is a variable that it is undefined.
Be sure that the function CASPER_BORESIGHT is compiled *before* any
reference to it. Otherwise a default variable is created.
Servus, Helge
--
------------------------------------------------------------ ----
| Helge Rebhan |
| Alfred-Wegener-Institut fuer Polar- @@@@ |
| und Meeresforschung ___||_ |
| \--/ oooo |--/ |
| Sektion Physik I ~~~\__________/~~~ |
| Am Handelshafen 12 |
| 27570 Bremerhaven |
| Tel. 0471-4831-287 |
| Fax. 0471-4831-425 e-mail : hrebhan@awi-bremerhaven.de |
------------------------------------------------------------ ----
|
|
|