<div dir="ltr">I realize that the background information was a bit vague. <div><br></div><div>In any case, thank you for confirming what I thought.<div><br></div><div>I was able to verify that the fortran code executed until the "return." However, it doesn't proceed to write a print statement in the NCL script immediately after the call to the WRAPIT fortran program. Hence, my thought that it was <i>not</i> "returning."</div><div><br></div><div>I will double check the code (perhaps simplify it), since you noted that the code should return.</div><div><br></div><div>Barry</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 11, 2017 at 9:20 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><pre>The question is a bit vague on details.<br><br>Yes, the fortran code 'returns' to the NCL calling environment.<br>You can put print statements in the fortran code to see what has executed.<br><br><br>====> fortran file: quad.f<br></pre><pre>C NCLFORTSTART
subroutine cquad (a, b, c, nq, x, quad)<br> implicit none<br> integer nq ! input<br> real a, b, c, x(nq) ! input<br> real quad(nq) ! output; must be pre-allocated in NCL
C NCLEND
C
C Calculate quadratic polynomial values.
C<br> </pre><pre> print *,"Before do loop" ! DEBUG<br></pre><pre> do i=1,nq<br> print *,"Before quad(i); i=",i<br> quad(i) = a*x(i)**2 + b*x(i) + c<br> print *,"After quad(i); quad(i)=",quad(i)<br> end do
<br> print *,"Before return: Done!" ! DEBUG
return
end<br><br>=====<br></pre><pre>%> WRAPIT quad.f<br><br></pre><pre>Creates quad.so<br>====<br></pre><pre>NCL script: example.ncl<br>===<br></pre><pre><br>external QUAD "./quad.so"
begin
;
; Calculate three values of a quadratic equation
;
nump = 3
x = (/ -1., 0.0, 1.0 /)
qval = new(nump,float) ; create memory for the 'return' values
QUAD::cquad(-1., 2., 3., nump, x, qval) ; Call the NCL version of
; your Fortran subroutine.
print("Polynomial value = " + qval) ; Should be (/0,3,4/)
end<br><br>====<br></pre><pre>%> ncl example.ncl<br></pre></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Jul 11, 2017 at 9:11 AM, Barry Lynn <span dir="ltr"><<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hello:<div><br></div><div>I wrote a fortran program that I can from an ncl program.</div><div><br></div><div>I have a "return" at the end of the fortran program, linked with WRAPIT.</div><div><br></div><div>However, my ncl program does not go beyond the call to the </div><div>WRAPIT fortran program call.</div><div><br></div><div>Am I missing something? I would expect the ncl program to return</div><div>and continue from there.</div><div><br></div><div>Thank you,</div><div><br></div><div>Barry<br clear="all"><div><br></div>-- <br><div class="m_-3595119192940889298m_-8004365432726582258gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US <a href="tel:(914)%20432-3108" value="+19144323108" target="_blank">914 432 3108</a><br></div></div></div>
</div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br>US 914 432 3108<br></div></div></div>
</div>