[R] Only referenc copy when calling C routine?

Shin, Daehyok sdhyok at email.unc.edu
Mon Apr 12 03:49:36 CEST 2004


Thanks, Murdoch.
The .Call is what I want.

In R extension manual,
"
Neither .Call nor.External copy their arguments. You should treat arguments
you receive through these
interfaces as read-only.
"

Daehyok Shin

> -----Original Message-----
> From: Duncan Murdoch [mailto:dmurdoch at pair.com]
> Sent: Sunday, April 11, 2004 PM 9:35
> To: Liaw, Andy
> Cc: 'sdhyok at email.unc.edu'; Liaw, Andy; R, Help
> Subject: Re: [R] Only referenc copy when calling C routine?
>
>
> On Sun, 11 Apr 2004 21:25:13 -0400, you wrote:
>
> >My understanding is that if DUP=FALSE, no copying is done in either
> >direction.
> >
> >If you want to avoid copying, the .Call interface is probably
> more suitable,
> >as you pass the actual R objects to the C function.  I'm not
> familiar with
> >that, though.
>
> If you're using C, .Call (or .External) is not really very hard to
> use.  You want to take a look at the examples in the Writing
> Extensions manual, and probably in one or two simple packages.
>
> The big limitation with .Call is that it is really only practical with
> C or C++ (because you definitely need to use the R header files),
> whereas .C and .Fortran make calls that just about any language can
> handle.
>
> Duncan Murdoch
>




More information about the R-help mailing list