[Rd] Registering native routines

Duncan Murdoch murdoch.duncan at gmail.com
Sat Feb 23 10:09:14 CET 2013

On 13-02-22 2:59 PM, Terry Therneau wrote:
> I'm working on registering all the routines in the survival package, per a request from
> R-core.  Two questions:
> 1. In the coxph routine I have this type of structure:
>        if (survival has 2 columns) routines <- c("coxfit5_a", "coxfit5_b", "coxfit5_c")
>           else                     routines <- c("agfit5_a",  "agfit5_b",  "agfit5_c")
> .....
>       .C(routines[1], arg1, etc
> I tried replacing "routines" with a vector of native symbol references, but it doesn't work
> Error in .C(routines[1], as.integer(n), as.integer(nvar), as.double(y),  :
>     first argument must be a string (of length 1) or native symbol reference

I imagine routines is a list in this case, so you should be using 
routines[[1]] to extract the element, rather than subsetting the list.

Duncan Murdoch

> I had fixed up all the other .C and .Call statements first (28 of them) and that worked,
> so the problem is not with finding the set of symbol references.
> 2. In the R-exts manual it mentions another argument "style" for C calls to specify if an
> argument is for input, output, or both.  However, I can find no details on how to use it.
> 3. A few of my routines still had a COPY argument.  I assume that is simply ignored?
> Terry T.
> R Under development (unstable) (2013-02-11 r61902)
> Platform: i686-pc-linux-gnu (32-bit)
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

More information about the R-devel mailing list