Hi All,
I'm attempting to get inline up and running for my package, but am having some
trouble. My plug in statement is:
inlineErnmPlugin <- Rcpp:::Rcpp.plugin.maker(
include.before = "#include <ernm.h>",
libs = "",
package = "ernm"
)
This works for some things. for example:
library(ernm)
library(inline)
registerPlugin("ernm",inlineErnmPlugin)
src <- "
Rcpp::IntegerMatrix tmp(0,2);
ernm::BinaryNet<ernm::Directed> net(tmp,Rcpp::as<int>(n));
return net;
"
emptyNetwork <- cxxfunction(signature(n="integer"), src, plugin="ernm")
net <- emptyNetwork(10)
net[1:10,1:10]
but for others it doesn't work. In particular, I keep a list of available
"model statistics" in a static class StatController, which I want my user to be
able to add to. When I try to interact with this list (well, map technically),
I get linking errors. I found a work around where the user could bring an XPtr
to the stat up to R, and then pass it down to add to the list with an exposed
Module function. This worked fine until the user quit R, at which point a
memory not mapped seg fault occurred.
Anyhow, I think I am probably missing some linking info from my inlinePlugIn
statement. I tried to hard code the library (perhaps naively), but got image
not found errors.
ip <- Rcpp:::Rcpp.plugin.maker(
include.before = "#include <ernm.h>",
libs =
"/Library/Frameworks/R.framework/Resources/library/ernm/libs/i386/ernm.so",
package = "ernm"
)
A reproducible example is located at
http://fellstat.com/files/ernmInlineTests.R for use with
http://fellstat.com/files/ernm_1.0.tar.gz . The only code in the package that
the examples interact with is StatController.h and StatController.cpp.
Any guidance would be greatly appreciated.
Best,
Ian
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel