Sébastien Durand wrote: > Thanks for your help, > > I had read those web pages already, and the post you referred to > already. > > So I will try to give more details to what I have done till now > > First I must mention again that I am using a mac under tiger. So I > am using .so files. > > My fortran file is called kmeans.f, and my subroutine or wrapper I > named it "wrapper" > > There is my first line of code > > subroutine wrapper(n, p, nran, mat, ishort, w, z, ntran, istand, > k1, k2, iassign, iseed) > > In the terminal: > R CMD SHLIB ~/Desktop/Fortan_kmeans/kmeans3.fg77 > -fno-common -g -O2 -c /Users/sebas/Desktop/Fortan_kmeans/ > kmeans3.f -o /Users/sebas/Desktop/Fortan_kmeans/kmeans3.o > gcc-3.3 -bundle -flat_namespace -undefined suppress -L/usr/ > local/lib -o > /Users/sebas/Desktop/Fortan_kmeans/kmeans3.so /Users/sebas/ > Desktop/Fortan_kmeans/kmeans3.o > -L/usr/local/lib/gcc/powerpc-apple-darwin6.8/3.4.2 -lg2c - > lSystem -framework R > > The files append to compile without any warnings. > > In R: > > > dyn.load("/Users/sebas/Desktop/Fortan_kmeans/kmeans3.so") > > getLoadedDLLs() > > Filename > base > base > grDevices /Library/Frameworks/R.framework/Resources/library/grDevices/ > libs/grDevices.so > stats /Library/Frameworks/R.framework/Resources/library/ > stats/libs/stats.so > methods /Library/Frameworks/R.framework/Resources/library/ > methods/libs/methods.so > kmeans3 /Users/sebas/Desktop/ > Fortan_kmeans/kmeans3.so > Dynamic.Lookup > base FALSE > grDevices FALSE > stats FALSE > methods FALSE > kmeans3 TRUE > > > Dyn.load seems to work since if I type in getLoadedDLLs() I can see > the link. > > > zozo=.Fortran(symbol.For("wrapper"),n=as.integer(n), p=as.integer > (p), nran=as.integer(nran), mat=as.matrix(mat), ishort=as.vector > (ishort), w=as.vector(w),ntran=as.integer(ntran), istand=as.integer > (istand), k1=as.integer(k1), k2=as.integer(k2), iassign=as.integer > (iassign), iseed=as.integer(iseed)) > Erreur dans .Fortran(symbol.For("wrapper"), n = as.integer(n), p = > as.integer(p), : > nom de fonction "Fortran" absent de la table d'allocation > > Even so I am using in the name parameter of the .Fortran function, > "wrapper", "kmeans3", "wrapper_" or "kmeans3_" > > I always get the same error call telling me that the fonction > "Fortran" is not in the allocation table
That message could be more useful, couldn't it? I think your problem is using symbol.For(). .Fortran uses that (or some internal equivalent), so it will end up being used twice, and R is probably looking for wrapper__, when the real name is wrapper_. Duncan Murdoch > > That is where I am at now, it has been 4 days I am digging into docs > but I haven't been able to find what I am doing wrong. > > R is so great, I got tons of Fortran lines and subroutine to > implement in R but I guess I am missing a little thing to make it > work and now I really don't have a cue how to solve that problem. > > Cheers > > I will be anxiously waiting for any reply > > Sébastien > > > >>If I understand correctly, you used >>.Fortran("wrapper",....) >> >>The problem might be that the function name ("wrapper") was changed >>in the >>compilation of the code! See the mail bellow for clues (a previous >>post on >>R-help by Duncan Murdoch) >> >>Natalie Hawkins wrote: >> >>>Using R 2.0.1 on Windows XP, I am getting an error >>>msg: >>> >>>Error in .Fortran("conic", nxy = nxy, npt = npt, CP = >>>cp, EP1 = ep1, EP2 = ep2, : >>> >>>Fortran function name not in load table >>> >>>I am wondering if there is a way to see what function >>>names are in the load table? Maybe the function name >>>has been altered? >> >>You need to look at the DLL to see what name it is exporting. I >>believe >>R would be looking for "conic_". If your Fortran compiler doesn't >>append underscores, you'll get this error. >> >>You might want to look at this page >> >>http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/ >>index.html#badname >> >>or this one >> >>http://www.stats.uwo.ca/faculty/murdoch/software/compilingDLLs/ >>fortran.html >> >>for more help. >> >>Duncan Murdoch > > > [[alternative HTML version deleted]] > > > > ------------------------------------------------------------------------ > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel