Many thanks Mathieu, following your answer I did a bit more focused
research and found out that because mypackage had a NAMESPACE, I had
to create the following zzz.R file instead:
.onLoad -function (lib, pkg) {
library.dynam(mypackage, pkg, lib)
}
I then had a look in Writing R extensions
[ Note that this discussion really belongs to r-help, not r-devel, but
a nyway.
On Tue, 27 Oct 2009 09:02:12 +1300,
Etienne Laliberté (EL) wrote:
Many thanks Mathieu, following your answer I did a bit more focused
research and found out that because mypackage had a NAMESPACE, I had
Function/file names are hypothetical. Say I have written myfunction.R,
which calls myfunction.c via .C(myfunction, ...).
I've compiled successfully myfunction.c via R CMD SHLIB myfunction.c
in the terminal. Then, in the R console:
dyn.load(myfunction.so)
source(myfunction.R)
test - myfunction()
Etienne Laliberté wrote:
Function/file names are hypothetical. Say I have written myfunction.R,
which calls myfunction.c via .C(myfunction, ...).
I've compiled successfully myfunction.c via R CMD SHLIB myfunction.c
in the terminal. Then, in the R console:
dyn.load(myfunction.so)
Dear Etienne,
You probably want to create a zzz.R file in the /mypkg/R/ folder which
is just
.First.lib - function(lib, pkg){
library.dynam(MyPkgName, package = pkg, lib.loc = lib)
return(invisible(0))
}
This would ensure that your shared library will be