comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Lost Functions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Lost Functions [message #10228 is a reply to message #10226] Fri, 24 October 1997 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
[This followup was also posted to comp.lang.idl-pvwave]

Matthew Hanson (matt@ktaadn.com) writes:

> 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?

Of course. :-)

Here is what is happening to you. Somewhere in the list
of procedures and functions that is being compiled *before*
your MY_FUNCTION is compiled is a call to the MY_FUNCTION
function. Since IDL doesn't yet know about the MY_FUNCTION
function, it figures the call:

result = MY_FUNCTION(whatever)

is a subscripted variable and it puts its name on its variable
name list. This list is consulted first before it looks at its
procedure and function list when it is trying to resolve the call.


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.

If you absolutely need to compile your programs first, then put
this command on the first line of your batch file:

Forward_Function MY_FUNCTION

Now the name "MY_FUNCTION" will be reserved for the function
and IDL will not get confused.

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: A rant: features vs. programming features
Next Topic: IDL Programming Techniques Course Full

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

Current Time: Mon Apr 27 12:29:09 PDT 2026

Total time taken to generate the page: 0.31919 seconds