Dear all,

I'm trying to compile FORTRAN code to be used in R, failing miserably. I got
a simple code function to try to figure out what is going wrong. Here is the
code (available on the web) :



      subroutine bar(n, x)

      integer n

      double precision x(n)

      integer i



      do 100 i = 1, n

          x(i) = x(i) ** 2

  100 continue



      end



1.     I compiled the code using 'R CMD SHLIB bar.f' in the terminal. This
created files .o and so of the same name. Got the following output in the
terminal :



R CMD SHLIB bar.f

gfortran -arch x86_64   -fPIC  -g -O2 -c bar.f -o bar.o

gcc -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names
-undefined dynamic_lookup -single_module -multiply_defined suppress
-L/usr/local/lib -o bar.so bar.o -lgfortran
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation





2.     Tried to dynamically load the code. In the R console, typed

> dyn.load("~/Documents/Marietravail/articles/MRTspatial/SIMSSDenR/bar.so")

Erreur dans
dyn.load("~/Documents/Marietravail/articles/MRTspatial/SIMSSDenR/bar.so") :

 impossible de charger la bibliothèque partagée
'/Users/maryh2002/Documents/Marietravail/articles/MRTspatial/SIMSSDenR/bar.so':
dlopen(/Users/maryh2002/Documents/Marietravail/articles/MRTspatial/SIMSSDenR/bar.so,
6): no suitable image found.  Did find:
/Users/maryh2002/Documents/Marietravail/articles/MRTspatial/SIMSSDenR/bar.so:
mach-o, but wrong architecture



I have :

Mac OS : 10.6.4

R 2.11.0 GUI 1.33 Leopard build 32-bit (5582)

Xcode version 3.2.3 64-bit

Installed gfortran 4.3.2



I hope this is all you need, feel free to ask me for any more info. Thank
you for your time,

MH

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to