[Rd] .Call interface: Use R SEXP as C mutable *char
Michael Bach
phaebz at gmail.com
Fri Mar 1 22:53:46 CET 2013
Dear R Developers,
DISCLAIMER: I am new to package development in R and new to this list.
I am trying to do something along the lines of:
SEXP test_fun (SEXP filename) {
const char *inputfile = translateChar(STRING_ELT(filename, 0));
int abc = some_function(inputfile);
...
}
The code compiles fine, but I get a warning:
"passing argument of 'some_function' discards qualifiers from pointer
target type"
I read up on my issue and found this posting:
https://stat.ethz.ch/pipermail/r-devel/2011-June/061221.html
I gather that the 'some_function' (which is a function from another
library) takes just '*char' as argument type so the 'const' qualifier is
discarded.
Of course I want my package to compile without warnings. All my other
attempts led to similar 'discard' warnings (mainly initializations of
helper variables).
What is the recommended approach here?
Best Regards,
Michael Bach
More information about the R-devel
mailing list