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> implicit none<BR> integer, intent(in) ::nq<BR> real, intent(in) ::a,b,c,x(nq)<BR> real, intent(out) ::quad(nq)<BR> integer ::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> quad = a*x**2+b*x+c<BR> return<BR>end subroutine cquad:<BR>***************************************<BR>Create a separate file, called "cquad90.stub" : <BR>**********************************<BR>C NCLFORTSTART<BR> subroutine cquad(a,b,c,nq,x,quad)<BR> real a,b,c<BR> integer nq<BR> 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> nump = 3<BR> x = (/ -1., 0.0, 1.0 /)<BR> qval = new(nump,float)<BR> EX01::cquad(-1., 2., 3., nump, x, qval) ; Call the NCL version of<BR> ; your Fortran subroutine.<BR> print("Polynomial value = " + qval) ; 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> xc = (/ 0., 1., 2. /)<BR> yc = (/ 0., 1., 0. /)<BR> arclen = EX01::arcln(nump,xc,yc) ; Call the NCL version of<BR> ; your Fortran function.<BR> print("Arc length = " + arclen) ; 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> <BR><BR> 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