[R-SIG-Mac] How to find system directory to shared library?

Kasper Daniel Hansen khansen at stat.Berkeley.EDU
Sun May 13 00:55:40 CEST 2007


On May 12, 2007, at 12:43 PM, cstrato wrote:

> Dear all
>
> In my package I need to get the path to the shared library  
> "mypackage.so".

Eh, why do you need to do so? I am not saying there could not be use  
cases, but most standard uses should not need to do this.

Kasper



> Currently, I use the following code:
>
>    mydir <- system.file(package="mypackage")
>    mylib <- paste(mydir, "/libs/mypackage.so", sep="")
>
> This did work with FC4 running R-2.4.1 and on my Intel-Mac running the
> development version of R-2.5.0, which I did compile from source.
>
> However, now I have downloaded and installed R-2.5.0.dmg and get an
> error since the shared library is now located in: "/libs/i386/ 
> mypackage.so"
> So I changed the code to:
>
>    mydir <- paste(system.file(package="mypackage"),  "libs", sep="/");
>    if (list.files(mydir) == "mypackage.so") {
>       mylib  <- paste(mydir, "mypackage.so", sep="/");
>    } else {
>       mylib  <- paste(mydir, list.files(mydir), "mypackage.so",  
> sep="/");
>    }
>
> This works since there is only one subdirectory "i386", but not if  
> there
> are "i386" and "ppc" subdirectories.
>
> Sorrowly, the following does not work:
>    system.file("mypackage.so", package = "mypackage")
>
> My question is, is there a better way to find the path to the shared
> library?
>
> Best regards
> Christian
> _._._._._._._._._._._._._._._._
> C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
> V.i.e.n.n.a       A.u.s.t.r.i.a
> _._._._._._._._._._._._._._._._
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac



More information about the R-SIG-Mac mailing list