Re: wrapit, gfortran trouble

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 06 Dec 2007 12:58:43 -0700

Hi Matt

I do not have a gfortran compiler available .... At least I don't know
where it exists.

I modified the test.sh scrip as follows and then used the default
f90 compiler on an SGI [IRIX OS] using the following modifications.

[1]
#WRAPIT -gf -l gfortran tester.stub tester.f90 # create sub.so
 WRAPIT tester.stub tester.f90 # create sub.so

[2]
I activated "Try 2" and "Try 3" in the f90 code.

It ran perfectly.

IMHO ... there is nothing wrong with what you did.

D
================================================
/home/tempest/shea> test.sh

WRAPIT Version: 051007
COMPILING tester.f90
LINKING
END WRAPIT

 Copyright (C) 1995-2007 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 5.0.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.

Variable: ng
Type: integer
Total Size: 4 bytes
            1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
        10
        10
 10

Matt Fearon wrote:
> Hi Mary,
> Thanks. However, I am not trying to pass strings and or characters at
> all. My test is very simple: Just passing an integer and printing it
> to the screen. Nothing more. If you have a few minutes, your take
> would be greatly appreciated. I understand you have plenty of other
> things going also. tester.stub and test.sh (includes NCL and fortran
> 90) are attached. Dennis, you fortran master, if you have a couple
> minutes, your thoughts would be greatly appreciated as well.
>
> thanks,
> Matt
>
>
>
> On Thu, 6 Dec 2007, Mary Haley wrote:
>
>> Hi Matt,
>>
>> I'm guessing the root of the problem may be due to one or more of the
>> character arrays being passed into the Fortran writeinter routine.
>> Although, I'm a bit puzzled by the error, because I didn't see a
>> reference to formatted strings in your f90 file. I'm not a f90 expert
>> by any means, though, so I could be off-base.
>>
>> Just in case: in order to pass character strings, you need to know
>> about the following:
>>
>> Arrays of character strings:
>>
>> Currently, the wrapper code used by WRAPIT honors only
>> non-dimensioned Fortran type CHARACTER variables. You cannot pass
>> arrays of NCL strings to Fortran, nor can you pass Fortran
>> CHARACTER arrays from Fortran back to NCL.
>>
>> Passing strings from NCL to Fortran:
>>
>> If you want to pass an NCL variable of type string to a Fortran
>> procedure, then the argument to the Fortran procedure must be
>> declared as CHARACTER*(*).
>>
>> Passing Fortran CHARACTER variables to NCL:
>>
>> If you want to pass a Fortran CHARACTER variable back to NCL, then
>> the Fortran argument must be a variable of type CHARACTER of fixed
>> length, and the corresponding NCL variable must be a character
>> array of the same length. If you want to use the NCL character
>> array as an NCL string, you will need to use the NCL conversion
>> function chartostring.
>>
>> You can look at:
>>
>> http://www.ncl.ucar.edu/Document/Tools/WRAPIT.shtml#Example_4
>>
>> for a small example of passing strings back and forth from NCL to
>> Fortran.
>>
>> If this doesn't help, then if you can send me the NCL script I'll
>> take a look.
>>
>> --Mary
>>
>> On Wed, 5 Dec 2007, Matt Fearon wrote:
>>
>>> Hi Mary,
>>> Thanks for your reply.
>>> adding: "-l gfortran" in the following statement:
>>> WRAPIT -gf -l gfortran chello.stub chello.f90 # creat sub.so
>>>
>>> allows WRAPIT to work, but then when NCL executes the fortran I get
>>> the following error:
>>>
>>> Fortran runtime error: Missing format for FORMATTED data transfer
>>>
>>> Never seen this error before. Thoughts?
>>> Matt
>>>
>>>
>>> On Wed, 5 Dec 2007, Mary Haley wrote:
>>>
>>>>
>>>> Hi Matt,
>>>>
>>>> I had a similar problem when I tried your scriopt, but was able to get
>>>> it to work by adding "-l gfortran" to this line:
>>>>
>>>> WRAPIT -gf -l gfortran chello.stub chello.f90 # creat sub.so
>>>>
>>>> Meanwhile, I'll check as to why WRAPIT is not including "-l gfortran"
>>>> automatically.
>>>>
>>>> Let me know if "-l gfortran" doesn't work for you.
>>>>
>>>> --Mary
>>>>
>>>>
>>>> On Wed, 5 Dec 2007, Matt Fearon wrote:
>>>>
>>>>> Sorry I forgot to attached scripts. Here they are.
>>>>>
>>>>> On Wed, 5 Dec 2007, Matt Fearon wrote:
>>>>>
>>>>>> Dear NCL users:
>>>>>>
>>>>>> Struggling with WRAPIT error linking NCL and gfortran. I have now
>>>>>> made my scripts very simple, but still receive the following error:
>>>>>>
>>>>>> warning:An error occurred loading the external file ./chello.so,
>>>>>> file not loaded
>>>>>> ./chello.so: undefined symbol: _gfortran_st_write_done
>>>>>> warning:error at line 6
>>>>>>
>>>>>> fatal:syntax error: line 12 before or near :
>>>>>> SUB1:
>>>>>> ----^
>>>>>>
>>>>>> fatal:error in statement
>>>>>> fatal:Syntax Error in block, block not executed
>>>>>> fatal:error at line 14
>>>>>>
>>>>>>
>>>>>> My shell script (test.sh which includes ncl and fortran 90) and
>>>>>> my f77 stub file (chello.stub) are attached. Seems like I have
>>>>>> had this trouble before, but I forget why. Help would be much
>>>>>> appreciated.
>>>>>>
>>>>>> thanks,
>>>>>> Matt
>>>>>>
>>>>>> _______________________________________________
>>>>>> ncl-talk mailing list
>>>>>> ncl-talk_at_ucar.edu
>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>
>>
> ------------------------------------------------------------------------
>
> C NCLFORTSTART
>
> subroutine tester(ng)
>
> integer ng
>
> C NCLEND
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 06 2007 - 12:58:43 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 11 2007 - 14:19:21 MST