> > > warning:Could not find Init() in external file ./erfc.so, file not
> > loaded
> > >
> > > "void Init(void)" does exist in erfc_W.c.
> > > Does anyone have an idea what this means?
> >
> > I recently asked if this problem has been solved.
> > The options I gave Mary personally are the same as the ones Jeff used.
> > Sorry, they are not anything new.
> >
> > Thus I still have the same problem.
> >
> > My guess is that ncl tries to find a symbol "Init()" on loading an
> > external library.
> > On a platform successfully do the job,
I could not find a way to suppress underscores from being prepended to
internal routine names, so I hard-coded an underscore in the calling
of the routine name to at least see if I could get shared objects
working.
The good news, it works! You can now use shared objects with NCL on
the Mac, but you have to email me for a new NCL binary.
Using the short Fortran subroutine and NCL script below, here's how
you create a shared object (I'm assuming the Fortran routine is named
"ex01.f" and the NCL script is named "ex01.ncl"):
wrapit77 < ex01.f > ex01W.c
g77 -fno-common -c ex01.f
nhlcc -fno-common -c ex01W.c
cc -bundle -flat_namespace -undefined suppress -o ex01.so ex01.o ex01W.o -lg2c
You can now run the script with "ncl < ex01.ncl"
You must get a new MacOSX binary from me (haley@ucar.edu) before
this will work, however!
Meanwhile, I will continue to see if there's a way to withhold the
pre-pending of underscores.
Cheers,
--Mary
C NCLFORTSTART
SUBROUTINE CQUAD (A,B,C,NQ,X,QUAD)
REAL X(NQ),QUAD(NQ)
C NCLEND
C
C Calculate quadratic polynomial values.
C
DO 10 I=1,NQ
QUAD(I) = A*X(I)**2 + B*X(I) + C
10 CONTINUE
C
RETURN
END
C NCLFORTSTART
FUNCTION ARCLN (NUMPNT, POINTX, POINTY)
DIMENSION POINTX(NUMPNT),POINTY(NUMPNT)
C NCLEND
C
C Calculate arc lengths.
C
IF (NUMPNT .LT. 2) THEN
PRINT *, 'ARCLN: Number of points must be at least 2'
STOP
ENDIF
ARCLN = 0.
DO 10 I=2,NUMPNT
PDIST = SQRT((POINTX(I)-POINTX(I-1))**2 +
+ (POINTY(I)-POINTY(I-1))**2)
ARCLN = ARCLN + PDIST
10 CONTINUE
C
RETURN
END
external EX01 "./ex01.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 new NCL version of
; your original Fortran subroutine
print("Polynomial value = " + qval)
;
; Calculate an arc length.
;
xc = (/ 0., 1., 2. /)
yc = (/ 0., 1., 0. /)
arclen = EX01::arcln(nump,xc,yc) ; call the new NCL version of
; your original Fortran function
if(arclen.ne.2.828427076339722)
print("ex01 failed")
else
print("ex01 success")
end if
print("Arc length = " + arclen)
end
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon Jul 29 2002 - 10:55:32 MDT