Robert Gentleman
1997-Nov-16 22:38 UTC
R-beta: installing new packages in window95 version of R
> From r-help-owner at stat.math.ethz.ch Mon Nov 17 11:20 NZD 1997 > Date: Sun, 16 Nov 1997 14:08:04 -0800 > From: Kung-Sik Chan <kchan at stat.uiowa.edu> > To: r-help at stat.math.ethz.ch > Subject: R-beta: installing new packages in window95 version of R > Mime-Version: 1.0 > > I have tried to install the leaps package in the window95 version of R. > I used Microsoft Fortran powerstation to generate > the .dll file of the fortran programs in the src dorectory > of the leaps package and put it under the lib directory of RSept. Then > I stored the leaps.R under the library directory of RSept, with two > additional commands in leaps.R (the .R extension was dropped): > library.dynam("leaps.dll")^M > provide(leaps)^M > > When I invoked the leaps library, the R functions in the file > can be printed out. However, when I ran the function, say, leaps(...), > I got the error message something like the fortran function "makeqr" is not > in the load table. > > Any suggestions on how to fix the problem? > > Kung-Sik > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-> 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 > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-I am not familiar with the leaps library so I don't know what functions it uses. If it relies on internal R functions (I hope that you got the R version) then you need to get your fortran compiler to export those functions from the dll with the correct collection of underscores (in the correct places), for Watcom C to figure out how to link to them. I have only had luck using Watcom C linked to C so far (and even that has not been entirely successful as demonstrated by the state of survival4). Luke Tierney has been providing some very helpful info on this as he is currently working on dynamic loading for Xlisp-Stat. He wrote:>I think I've worked out what the sort of official way of doing things >in windows is. You mark the functions in the executable for export, >either with a __declspec(dllexport) or in a .def file. Create the >executable, say r.exe, and from it create a r.lib file (in VC you use >LIB, in BCC you use IMPLIB -- I haven't checked watcom yet but I'm >sure there is something analogous). Then link r.lib with your dll. > >The only problem with this is you have to explicitly export all >symbols in R you want to make available. I have not found any way of >making all externals exported in BCC or in VC. It looks like BCC lets >you do that in 16bit apps but not 32, unless I've just missed >something. My notes on AIX also indicate that AIX requires an >explicit export file, so this can happen on Unix too (again assuming I >haven't missed some way of exporting all externals). > >Another point that may not affect you but does me: If you want to >acces a global variable in R from a dll you need to declare it >__declspec(dllimport) in the dll (doing this for functions is optional >and improves calling speed, at least in VC or so they claim, but it is >mandatory for data -- whithout it everythign links happily and blows >up at runtime). > >lukeBut I haven't had time to do any of that. robert =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-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 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=