Hi, I have some S functions plus Fortran routines that I want to use in R. They work in S, but when I try to use "dyn.load" to link fortran codes in R , I get the following error. thanks, reza (I am using R-1.0.1 on windows NT, The name of fortran file (compiled Ratfor) is deldirld.o and it's in the D:\Reza\476\tv.gonsrc.R\ directory)>dyn.load("deldirld.o")Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library "D:\Reza\476\tv.gonsrc.R\deldirld.o": LoadLibrary failure ************************************************************************** Reza S. Mahani e-mail: mahani at uiuc.edu Department of Economics phone(Office): (217) 333-4581 University of Illinois at Urbana-Champaign phone(Home): (217) 384-0987 330 comm. west, 1206 S. sixth st. FAX: (217) 244-6678 Champaign, IL 61820, USA www.students.uiuc.edu\~mahani -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, 18 Jun 2000, reza shahidzadeh mahani wrote:> Hi, > I have some S functions plus Fortran routines that I want to use in R. > They work in S, but when I try to use "dyn.load" to link fortran codes in > R , I get the following error. > thanks, reza > > (I am using R-1.0.1 on windows NT, The name of fortran file (compiled > Ratfor) is deldirld.o and it's in the D:\Reza\476\tv.gonsrc.R\ directory) > > >dyn.load("deldirld.o") > Error in dyn.load(x, as.logical(local), as.logical(now)) : > unable to load shared library > "D:\Reza\476\tv.gonsrc.R\deldirld.o": > LoadLibrary failureOh dear! How did you get "deldirld.o" and where did you get the idea you can dyn.load .o files on R for Windows? (You can't do that on S-PLUS for Windows either, so I have no idea how they `work in S'.) If you look at help(dyn.load) in R it says Arguments: libname: a character string giving the pathname to a DLL. Normally if you try something like this on NT you get a dialog box giving further information, and rw1010 is intended to get the maximal information out of Windows. What you need for dyn.load is a DLL, specifically a 32-bit relocatable DLL with all dependent DLLs in the load path (the directory from which the DLL is loaded plus the PATH setting). So you need to go back to your compiler manuals and work out to make such a DLL. If you are using the mingw32 version of g77 as recommended for building packages, the simplest way is to set up a minimal package sources and run make pkg-mypkg Since the availability of tools has changed since rw1001, we suggest you get rw1010 and work with that. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, Jun 18, 2000 at 09:00:16PM -0500, reza shahidzadeh mahani wrote:> (I am using R-1.0.1 on windows NT, The name of fortran file (compiled > Ratfor) is deldirld.o and it's in the D:\Reza\476\tv.gonsrc.R\ directory) > > >dyn.load("deldirld.o") > Error in dyn.load(x, as.logical(local), as.logical(now)) : > unable to load shared library > "D:\Reza\476\tv.gonsrc.R\deldirld.o": > LoadLibrary failureR can only load dynamic link library (dll) not object file. Hence, look to your compiler manual on how you can generate a dll. More details, including instruction for mingw, VC++ and Borland C++ are in the README.PACKAGES file included in the rwXXXXsp.zip bit of the binary distribution. guido -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._