I am currently running R under Windows95. I am entirely new to R in any environment, with no prior experience of S or S-Plus either. I want to run some functions written for S-plus and residing in a file "cat.s". The fuctions also call some Fortran routines residing in a compiled fortran file "cat.obj" In S-Plus as I understand it I am supposed to first dyn.load("cat.obj") then source("cat.s") in order to run the added functions. When I am trying this in R it seems that the R dyn.load expects a directory name (according to the html help-page) whereas S-Plus expects a file name. A dyn.load("cat.obj") referencing the file name produces this error message: Error in dyn.load(x) : unable to load shared library "C:\Program\r.gnw\library\cat\cat.obj" However if I instead make a reference to the directory were my Fortran file resides R still comes up with an error message: dyn.load("cat") Error in dyn.load(x) : unable to load shared library "C:\Program\r.gnw\library\cat" I have tried to "invoke" R from different directories (by providing different initial directories in the Windows95 program information file) so it will have no reason to miss the Fortran object file. I have also tried different suffixes to the Fortran file such as .o and .for. I suppose I also have to rename the "cat.s" file to "cat.R" I have searched the Notes on R, the FAQ and naturally the html help files but cannot find any clues. (by the way, I have not managed to dyn.load the file (zero.c) residing in the directory "\demos\dynload\" either) Could anyone please come up with a solution. Thanks very much Thor -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
guido@sirio.stat.unipd.it
1998-May-14 13:42 UTC
R-beta: How do I dyn.load in R for Windows95?
Thor Thoresen writes:> > I am currently running R under Windows95. > dyn.load("cat.obj") > > then > > source("cat.s") > > in order to run the added functions. > > Error in dyn.load(x) : unable to load shared library > "C:\Program\r.gnw\library\cat\cat.obj" > > However if I instead make a reference to the directory were my > Fortran file resides R still comes up with an error message: > > dyn.load("cat") > > Error in dyn.load(x) : unable to load shared library > "C:\Program\r.gnw\library\cat" > > I have tried to "invoke" R from different directories (by providing > different initial directories in the Windows95 program information file) > so it will have no reason to miss the Fortran object file. I have also > tried different suffixes to the Fortran > file such as .o and .for. I suppose I also have to rename the "cat.s" > file to "cat.R"You have to build a dll (dynamic link library). It is not a problem of suffixes. If you get the above message the file is found. But its format is not the one expected. You should be able to build a dll with the compiler that you use to make the cat.obj file. This dll must be self contained (see below).> (by the way, I have not managed to dyn.load the file (zero.c) residing > in the directory "\demos\dynload\" either)This opens another question. With the actual pre-compiled distribution of R for Win95 (both of them) is impossible to have a dll calling a routine in main executable. I hope to make available a version of R with this capability soon (next few days). But, in this period, i.e., always, time is diffucult to find. guido masarotto -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._