I have an external pointer object that I'd like to pass from my R code to some C code. Per Section 5.13 of "Writing R Extensions", I've noted that "external pointers should only be used as part of an object with normal semantics, for example an attribute or an element of a list." So I've written up a workable C function as such:
SEXP my_c_function(SEXP param) { SEXP temp = getAttrib(param, install("ptr_attribute")); void * ptr = R_ExternalPtrAddr(temp); ... // do useful things with ptr } I can pass my_c_function() an object with "normal" semantics (such as an integer vector), where the external pointer object is a parameter named "ptr_attribute". The function extracts the pointer object from param; i.e. this function does what I want it to do. My question is: is there a way to do this using the .C() interface, rather than .Call()? Using call_R seems a possibility - has anyone had luck going this route? Any suggestions appreciated. Thanks, Patrick [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel