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

cstrato cstrato at aon.at
Sat May 12 21:43:41 CEST 2007


Dear all

In my package I need to get the path to the shared library "mypackage.so".
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
_._._._._._._._._._._._._._._._



More information about the R-SIG-Mac mailing list