Re: Function referencing/automatic defintion question. [message #35394 is a reply to message #35393] |
Thu, 29 May 2003 08:14  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Paul van Delst (paul.vandelst@noaa.gov) writes:
> So my question is: what's the go here? Why doesn't my calling procedure "see" the compiled
> functions that precede my structure definition? I thought the whole point of sticking
> these routines *before* the procedure in my emiscoeff__define.pro file that actually does
> the definition meant that they would be compiled?
>
> Any insights appreciated,
>
> paulv
>
> p.s. When I manually compile the emiscoeff__define.pro file I get the following:
>
> IDL> .run emiscoeff__define
> % Compiled module: ASSOCIATED_EMISCOEFF.
> % Compiled module: DESTROY_EMISCOEFF.
> % Compiled module: ALLOCATE_EMISCOEFF.
> % Compiled module: ASSIGN_EMISCOEFF.
> % Compiled module: COUNT_EMISCOEFF_SENSORS.
> % Compiled module: EMISCOEFF__DEFINE.
>
> How come I don't get this list when I do the automatic compilation via
>
> EmisCoeff = { EmisCoeff }
>
> ???
Having the function in front of the object definition
module is a necessary, but not sufficient (at least in
this case) condition for getting it to compile correctly. :-)
The problem (almost certainly) is that a program
module that *calls* this function is being compiled
before the function is compiled.
You could solve this problem in several ways. (1) Take
the function out of this file and put it in a file of
its own. (2) Make the function a method of the object.
I think solution 2 is probably the better one in this case,
since the function is obviously related to the object in
a tight way. (In fact, I can't see why *all* of these modules
aren't object methods. Do you have a reason for this that is
not apparent to me?)
But if you want to keep it the way it is, I would just move
this function to the top of the file, or add a FORWARD_FUNCTION
statement in the module that uses it.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|