[R] Only referenc copy when calling C routine?

Duncan Murdoch dmurdoch at pair.com
Mon Apr 12 03:35:25 CEST 2004


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