Re: Help: I can't calling F90 subroutine in NCL

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun, 22 Oct 2006 20:16:04 -0600 (MDT)

The parser used by the underlying code understands
only f77 syntax. You are using :: which is f90.

Try

C NCLFORTSTART
      subroutine read(in,out)
      character(*)* in
      character*8 out
 C NCLEND

Good luck
> --------------------------------------------

On Mon, 23 Oct 2006, lxf wrote:
> hi,
> I have a problem in using WRAPIT to call F90 subroutine in NCL. The F90 subroutine
> "lxf.f90" can't be called in NCL,
>
> subroutine read(in,out)
> character(len=*) :: in
> character*8 :: out
> print *,in
> out="for--ncl"
> end subroutine read
>
> but I am sure that it is right when the F90 subroutine is modified like this:
> subroutine read(in,out)
> character(*) in
> character*8 out
> print *,in
> out="for--ncl"
> end subroutine read
>
> I just can't find out the reason.
> Any suggestion are much appreciated!
>
> To show the details in my operation, I used a csh file("1.csh")to do the job :
> %> 1.csh >& 1.out
>
> The "1.csh" and "1.out" is in the following,
> and I hope the problem is clear in them.
>
> yours,
> Li
>
> *******************************************************
> "1.csh":
> ====================
> #! /bin/csh -f
> echo "1) cat lxf.f90"
> cat lxf.f90
> echo "--------------------------------------------"
>
> echo "2) cat lxf.stub"
> cat lxf.stub
> echo "--------------------------------------------"
>
> echo "3) cat lxf.ncl"
> cat lxf.ncl
> echo "--------------------------------------------"
>
> echo "4) WRAPIT -pg lxf.stub lxf.f90"
> WRAPIT -pg lxf.stub lxf.f90
> echo "--------------------------------------------"
>
> echo "5) ncl -x lxf.ncl"
> ncl -x lxf.ncl
> =========================
>
> "1.out":
> =========================
> 1) cat lxf.f90
> subroutine read(in,out)
> character(len=*) :: in
> character*8 :: out
> print *,in
> out="for--ncl"
> end subroutine read
> --------------------------------------------
> 2) cat lxf.stub
> C NCLFORTSTART
> subroutine read(in,out)
> character(len=*) :: in
> character*8 :: out
> C NCLEND
> --------------------------------------------
> 3) cat lxf.ncl
> external SUB "./lxf.so"
> begin
> out=new(8,character)
> in="ncl-for"
> SUB :: read(in,out)
> b=chartostring(out)
> print(b)
> end
> --------------------------------------------
> 4) WRAPIT -pg lxf.stub lxf.f90
>
> WRAPIT Version: 041106
> /usr/pgi/linux86/5.0/bin/pgf90
> A syntax error occurred while parsing: (
> COMPILING lxf.f90
> LINKING
> END WRAPIT
>
> --------------------------------------------
> 5) ncl -x lxf.ncl
> Copyright (C) 1995-2006 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 4.2.0.a033
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> + external SUB "./lxf.so"
> warning:Could not find Init() in external file ./lxf.so, file not loaded
>
> + begin
> + out=new(8,character)
> + in="ncl-for"
> fatal:syntax error: line 5 in file lxf.ncl before or near :
> SUB :
> -------^
>
>
>
> fatal:syntax error: possibly an undefined procedure
>
> + SUB :: read(in,out)
> + b=chartostring(out)
> + print(b)
> + end
> fatal:Syntax Error in block, block not executed
>
> =========================
>
>
>
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Oct 22 2006 - 20:16:04 MDT

This archive was generated by hypermail 2.2.0 : Mon Oct 23 2006 - 08:51:16 MDT