Re: wrapit, gfortran trouble

From: Matt Fearon <matt_at_nyahnyahspammersnyahnyah>
Date: Thu, 6 Dec 2007 13:22:57 -0500 (EST)

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

Received on Thu Dec 06 2007 - 11:22:57 MST

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