xuan zhao
2012-Jun-22 18:36 UTC
[R] problem with loading the dynamic object(.so file) inside a R package
I have built a R package including the C code. My question is: Can the shared object get loaded automatically as we load the R package? In my case, I have to do dyn.load("dirc/filename.so") in the R script to load the shared object, which is very inconvenient. Is there anyway to make R to load this dynamic object automatically when we load the package by doing library(libname)? Thanks! -- View this message in context: http://r.789695.n4.nabble.com/problem-with-loading-the-dynamic-object-so-file-inside-a-R-package-tp4634241.html Sent from the R help mailing list archive at Nabble.com.
R. Michael Weylandt
2012-Jun-22 19:49 UTC
[R] problem with loading the dynamic object(.so file) inside a R package
I believe that useDynLib() in the NAMESPACE file should do it for you. Best, Michael On Fri, Jun 22, 2012 at 1:36 PM, xuan zhao <xuan.zhao at sentrana.com> wrote:> I have built a R package including the C code. My question is: > Can the shared object get loaded automatically as we load the R package? > In my case, I have to do dyn.load("dirc/filename.so") in the R script to > load the shared object, which is very inconvenient. > Is there anyway to make R to load this dynamic object automatically when we > load the package by doing library(libname)? > Thanks! > > > -- > View this message in context: http://r.789695.n4.nabble.com/problem-with-loading-the-dynamic-object-so-file-inside-a-R-package-tp4634241.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.