Hello,

I am trying to build a package but I have quite a few dependencies. As such, I
have modified Makevars to be (I don't like backticks because I find them too
similar to single quotes):

PKG_LIBS = $($(R_HOME)/bin/Rscript -e 'Rcpp:::LdFlags()') -L. -llink_4_1b -lDGG 
-lSTR -lDLL -lAF -lmy_std -lm
PKG_CPPFLAGS=-I. -g

Which seems to compile when my R wrapper is (incorrectly):

RcppExport SEXP getDocGraph(std::string input){
    
    std::string testStr = input;
    std::string output=getDG(testStr);
    return(Rcpp::wrap(output));
}

but then it gives me a segmentation fault because it cannot access the
underlying character array (or general object) passed in by R.

Then if I change the function protoype to:

RcppExport SEXP getDocGraph(SEXP input){
    
    std::string testStr = Rcpp::as<std::string>(input);
    std::string output=getDG(testStr);
    return(Rcpp::wrap(output));
}

it seems to compile, but when I go to check the package, the .Rcheck directory
gives me an error:

** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object ...<packagename>.so':

and the .so file is not in the tgz package, but no error was given during
compilation.

Any help is greatly appreciated.

Thanks!

Jacob Russell
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to