Lost Functions [message #10226] |
Fri, 24 October 1997 00:00  |
Matthew Hanson
Messages: 11 Registered: October 1997
|
Junior Member |
|
|
I have been having a very bizaare problem in IDL 5.0 on Solaris 2.6
involving Functions becoming 'lost'.
In my batch file i compile all functions. Output reads as expected:
Compiled Module: MY_FUNCTIONS
Then the batch file calls a main, the main then calls MY_FUNCTION, but
instead of working it says : Unknown Variable: MY_FUNCTION, even though
right above it it says that it is a compiled function. If you type Help
at this point MY_FUNCTION appears as a valid function.
Now here is the even weirder part.
I commented out MY_FUNCTION and put in a STOP. After the program stops
I enter MY_FUNCTION at the command prompt Exactly as it appears in the
script. It works fine. But if i .continue it will fail as before. I
have seen this behavior with several different functions.
Has anyone else experienced this?
--
Matthew Hanson
KTAADN, Inc. Phone: (617)527-0054
1320 Centre Street, Suite 201 Fax: (617)527-9321
Newton, MA 02159
matt@ktaadn.com matth@who.net vroomfogle@worldnet.att.net
|
|
|
|
Re: Lost Functions [message #10264 is a reply to message #10226] |
Tue, 04 November 1997 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
David Fanning wrote:
>
> [This followup was also posted to comp.lang.idl-pvwave]
>
> Matthew Hanson (matt@ktaadn.com) writes:
>
[cut]
> Most of the time this kind of problem is resolved by having
> your programs be compiled automatically when they are needed.
> In other words, give your program files the same name as the
> procedure or function and let IDL find them when it needs them.
let me just add a little note on seperate files vs. "libraries", because
I don't think this is mentioned in the IDL manuals:
It seems as if the automatic compilation of IDL always compiles up to
the
point where it finds the procedure or function with the same name as the
filename. Hence, if you have some functions that are closely related,
and
you don't want them all in seperate files, you have to make sure that
you
call the last one first - or that all your *sub*routines precede your
*main*pro(cedure/gram). I use this for a usage mechanism, so instead of
writing out the usage lines within my procedure, I define a
use_<procname>
procedure and this is called when an error is detected in the parameters
passed.
Also, in this respect, it may be of interest to note that IDL is not
completely
case-insensitive when trying to match a filename with a procedure name.
I once
tried a procedure name test_3D.pro, and IDL did not like it, although
the procedure
is named completely identical. Here is what I got:
% Attempt to call undefined procedure/function: 'TEST_3D'.
% Execution halted at: $MAIN$
Regards,
Martin
------------------------------------------------------------ -------------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-9837
Please indicate name and room (186 Pierce) when sending a fax
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------------
|
|
|