WRAPIT script for Fortran 90 code

From: Changlin Chen <clchen_at_nyahnyahspammersnyahnyah>
Date: Sun, 26 Jul 2009 15:37:25 +0800

Hi:
I using the WRAPIT script for Fortran 90 code.
I follow the manuals in http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml.

Create file "cquad.f90":
************************************
subroutine cquad(a,b,c,nq,x,quad)
  implicit none
  integer, intent(in) ::nq
  real, intent(in) ::a,b,c,x(nq)
  real, intent(out) ::quad(nq)
  integer ::i
  quad = a*x**2+b*x+c
  return
end subroutine cquad:
***************************************
Create a separate file, called "cquad90.stub" :
**********************************
C NCLFORTSTART
      subroutine cquad(a,b,c,nq,x,quad)
      real a,b,c
      integer nq
      dimension x(nq),quad(nq)
C NCLEND
******************************************
And then run the ncl file test.ncl:
******************************************
external EX01 "./cquad90.so"
begin
;
; Calculate three values of a quadratic equation
;
   nump = 3
   x = (/ -1., 0.0, 1.0 /)
   qval = new(nump,float)
   EX01::cquad(-1., 2., 3., nump, x, qval) ; Call the NCL version of
                                           ; your Fortran subroutine.
   print("Polynomial value = " + qval) ; Should be (/0,3,4/)
;
; Calculate an arc length.
;
   xc = (/ 0., 1., 2. /)
   yc = (/ 0., 1., 0. /)
   arclen = EX01::arcln(nump,xc,yc) ; Call the NCL version of
                                        ; your Fortran function.
   print("Arc length = " + arclen) ; should be 2.82843
end
******************************************

An error occur:
warning:An error occurred loading the external file ./cquad90.so, file not loaded
./cquad90.so: undefined symbol: NclGetArgValue
warning:error at line 4 in file test.ncl

So what's the problem? Thanks!
   

           Clchen

z{Sʗ{٥r
z{S}ĝxjǺ<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>Hi:<BR>I using the WRAPIT script for Fortran 90 code.<BR>I follow the manuals in http://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclExtend.shtml.<BR></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p>Create file "cquad.f90": <BR>************************************<BR>subroutine cquad(a,b,c,nq,x,quad)<BR>&nbsp; implicit none<BR>&nbsp; integer, intent(in)&nbsp; ::nq<BR>&nbsp; real,&nbsp;&nbsp;&nbsp; intent(in)&nbsp; ::a,b,c,x(nq)<BR>&nbsp; real,&nbsp;&nbsp;&nbsp; intent(out) ::quad(nq)<BR>&nbsp; integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ::i</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p>&nbsp; quad = a*x**2+b*x+c<BR>&nbsp; return<BR>end subroutine cquad:<BR>***************************************<BR>Create a separate file, called "cquad90.stub"&nbsp;: <BR>**********************************<BR>C NCLFORTSTART<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subroutine cquad(a,b,c,nq,x,quad)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; real a,b,c<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integer nq<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimension x(nq),quad(nq)<BR>C NCLEND<BR>******************************************</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p>And then run the ncl file test.ncl:<BR>******************************************<BR>external EX01 "./cquad90.so"</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p>begin<BR>;<BR>; Calculate three values of a quadratic equation<BR>;<BR>&nbsp;&nbsp; nump = 3<BR>&nbsp;&nbsp; x&nbsp;&nbsp;&nbsp; = (/ -1., 0.0, 1.0 /)<BR>&nbsp;&nbsp; qval = new(nump,float)<BR>&nbsp;&nbsp; EX01::cquad(-1., 2., 3., nump, x, qval) ; Call the NCL version of<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; your Fortran subroutine.<BR>&nbsp;&nbsp; print("Polynomial value = " + qval)&nbsp;&nbsp;&nbsp;&nbsp; ; Should be (/0,3,4/)</o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p>;<BR>; Calculate an arc length.<BR>;<BR>&nbsp;&nbsp; xc = (/ 0., 1., 2. /)<BR>&nbsp;&nbsp; yc = (/ 0., 1., 0. /)<BR>&nbsp;&nbsp; arclen = EX01::arcln(nump,xc,yc)&nbsp;&nbsp;&nbsp;&nbsp; ; Call the NCL version of<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ; your Fortran function.<BR>&nbsp;&nbsp; print("Arc length = " + arclen)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;&nbsp; should be 2.82843<BR>end<BR>******************************************</o:p></SPAN></P><SPAN lang=EN-US style="mso-bidi-font-size: 10.5pt"><o:p>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><BR>An error occur:<BR>warning:An error occurred loading the external file ./cquad90.so, file not loaded<BR>./cquad90.so: undefined symbol: NclGetArgValue<BR>warning:error at line 4 in file test.ncl<BR></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt">So what's the problem? Thanks!<BR>&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Clchen</o:p></SPAN></P>
z{Sʗ{VZǭ0U슉
z{S}ĝx;
z{Ch+bx)ޝmjY&j)b b.+-{--rz)*'칻&ކiYnffX)ߣܖ֥
Received on Sun Jul 26 2009 - 01:37:25 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 29 2009 - 09:07:41 MDT