Hello, I used a mac G5, R.2.1.1, and G77 3.4.4 and I would like to use and call a fortran subroutine. The trouble is that it seems I am not able to correctly load the compiled code.
Here is what I have done: In the terminal this how I compiled my fortran code: R CMD SHLIB ~/Desktop/Fortan_kmeans/kmeans3.f There is the wrapper I have paste inside de kmeans3.f file: c THIS IS THE WRAPPER subroutine wrapper(n, p, nran, mat, ishort, w, z, + ntran, istand, k1, k2, iassign, iseed) integer n,p,kmax real*8 mat(n,p),sx(kmax,p),sx2(kmax,p),vect(p), + xbar(kmax,p),var(kmax,p),mean(p),coord(10) real*8 D1,Dref,SSE,SSEref,Dvec(kmax),w(p),SST real*8 CH,CHr(kmax),SSEr(kmax),temp integer list(n),howmany(kmax),no(n),nobest(kmax) integer listr(kmax,n),howmanyr(kmax,kmax),nnitr(kmax) integer ishort(p) double precision kmeans, external kmeans call kmeans(n, p, nran, mat, ishort, w, + ntran, istand, k1, k2, iassign, iseed) end c THIS IS THE BEGINNING OF THE ORIGINAL FORTRAN CODE subroutine kmeans(n, p, nran, mat, ishort, w, + ntran, istand, k1, k2, iassign, iseed, CHr, SSEr) ...... Once compiled, in R, I get the following: > dyn.load("/Users/sebas/Desktop/Fortan_kmeans/K-means3.so") > getLoadedDLLs() Filename 1 base 2 /Library/Frameworks/R.framework/Resources/library/grDevices/libs/ grDevices.so 3 /Library/Frameworks/R.framework/Resources/library/stats/ libs/stats.so 4 /Library/Frameworks/R.framework/Resources/library/methods/libs/ methods.so 5 /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so Dynamic.Lookup 1 FALSE 2 FALSE 3 FALSE 4 FALSE 5 TRUE > > is.loaded(symbol.For("/Users/sebas/Desktop/Fortan_kmeans/ kmeans3.so")) [1] FALSE > is.loaded(symbol.For("kmeans3")) [1] FALSE > is.loaded(symbol.For("wrapper")) [1] FALSE Then whatever I write in .Fortran("",...), I always get : Erreur in .Fortran("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so",... : the function name "Fortran" is absent of the allocation table (this warning was translated from french) So if anyone got a clue, please let me know. I would be more than happy to find and understand what I am doing wrong! Cheers Sébastien Durand ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel