Re: [Rd] Is it possible to pass a function argument from R to compiled code in C?

From: Jeffrey Ryan <>
Date: Tue, 20 Sep 2011 13:12:49 -0500

You can't call "R" code as if it is C code. It is R, and requires that it be evaluated. How would your C know what to do with an R pointer...

.Call is more efficient than .C, all the time. Check this list and experiment. That said, you can still call "just C" within the .Call "R" function, it really is 'just C' in there.

Probably something like a simple example of what you are trying to do would help the list steer you into the right direction (steer, since you seem to be missing something in your thinking on this...)


On Tue, Sep 20, 2011 at 1:07 PM, Alireza Mahani <> wrote:
> OK, thanks. But there are two issues with using ".Call":
> 1- I may give up performance if I am literally running R code inside C,
> right? In some ways, wouldn't it defy the purpose of calling a compiled code
> if I end up back in R?
> 2- If I use the ".Call" interface, the resulting code will be tailored to R,
> i.e. I will end up having the lengthy code with all the R macros in it. I
> always prefer to use ".C" interface because I can use the exact same piece
> of code inside of a C program, i.e. I can call the same function either from
> R or from C. But with .Call, I am passing R's pointers into the function,
> which obviously I won't be doing when my call comes from inside of C.
> Nevertheless, it's good to know that there is at least a sub-optimal
> solution out there (sub-optimal from my perspective, of course!).
> -Alireza
> --
> View this message in context:
> Sent from the R devel mailing list archive at
> ______________________________________________
> mailing list

Jeffrey Ryan

______________________________________________ mailing list
Received on Tue 20 Sep 2011 - 18:17:19 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 20 Sep 2011 - 19:20:36 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive