Re: Load command

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 19 Jul 2006 09:07:57 -0600 (MDT)

On Mon, 17 Jul 2006, Dennis Shea wrote:

> I am sure Mary or Dave Brown will correct me if I am wrong.
>
> I have wanted to do the same type thing
> but with shared objects which were compiled with
> different compilers.
>
> OS = systemfunc("uname")
>
> if (OS.eq."IRIX") then
> external FOO /ptmp/shea/irix/foo.so
> end if
> if (OS.eq."SunOS") then
> external FOO /ptmp/shea/sun/foo.so
> end if
> :
> :
>
> However, even if I was on an SGI machine running IRIX,
> NCL would try to load the SUN .so file. This obviously
> caused problems.
>
> My guess is that it can not be done under the current implementation.
>
> D
>
>

Dennis is correct on his assumption.

The NCL developers have been looking into this offline. Rick Grubin
said using conditionals around external statements doesn't work
because 'external' is one of those keywords/ commands that, regardless
of where it shows up, is executed by NCL. That is, it won't matter if
you wrap it in a conditional statement, when the NCL script is scanned
for syntax/etc., it executes an 'external' command.

You can, however, have conditionals around a "load" statement. Be
aware, though, that NCL will make an initial pass and load every
single script in a "load" command to make sure all the commands in the
loaded script are valid. As a result, if any of your scripts being
loaded contain functions or procedures with the same name, NCL will
issue a fatal error and quit. After that point, however, only
the load statements inside conditionals that are met will be loaded.

We may research this a little bit and see if there's something we can
do to improve the behavior of the "external" and "load" statements.
Please let us know if this "feature" is keeping you from using NCL
effectively.

--Mary

>> Is the NCL "load" command an executable statement, or some sort of
>> static directive to NCL? I would like to use an if block to load
>> scripts conditionally, but this does not seem to work as expected. The
>> load command seems to be always "executed" without regard to the if
>> statement.
>>
>> Simplified example:
>>
>> if (lib_flag .ne. 1) then
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> end if
>>
>> Thank you for any advice on how to do this.
>>
>> --Dave Allured
>> CIRES Climate Diagnostics Center
>> NOAA Earth Systems Research Laboratory, Physical Sciences Division
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk_at_ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 19 2006 - 09:07:57 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 19 2006 - 09:13:26 MDT