[R] loading shared libraries at startup

Thomas Lumley tlumley at u.washington.edu
Tue Mar 13 01:44:12 CET 2001


On Mon, 12 Mar 2001, Faheem Mitha wrote:

> Dear people,
>
> I compiled a bit of C code into a shared library cftpR.so, and load it
> into R at runtime using
>
> > dyn.load("cftpR.so")
>
> This works fine, however when I put
>
> .First <- function()
> {
> dyn.load("/home/faheem/research/cftp/cftpR.so")
> }
>
> (using absolute path names; also tried with just dyn.load("cftpR.so")),
> into my .Rprofile to load the library at startup, the library doesn't get
> loaded. I am sure I am missing something obvious, but I spent a while
> trying different things and reading documentation, but no dice. So, I
> crave your indulgence.

It works when I do it.

aleph% more .Rprofile
.First<-function(){
  print(".First is being run")
  dyn.load("~/Rarchive/libloc/survival5/libs/survival5.so")
  print(is.loaded(symbol.C("coxdetail")))
}
aleph% R
...

[Previously saved workspace restored]

[1] ".First is being run"
[1] TRUE

What are the symptoms: do you get an error message? How do you tell it
wasn't loaded? Is .First() being run?


	-thomas

Thomas Lumley			Asst. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle
^^^^^^^^^^^^^^^^^^^^^^^^
 NOTE NEW EMAIL ADDRESS

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list