[Rd] Registration of native routines

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Feb 15 08:01:58 CET 2017


On 14/02/2017 17:28, Avraham Adler wrote:
> On Tue, Feb 14, 2017 at 11:25 AM, Prof Brian Ripley
> <ripley at stats.ox.ac.uk> wrote:
>> Registration of 'native routines' (entry points in compiled code loaded into
>> R) has been available for over 14 years, but few packages make use of it
>> (less than 10% of those on CRAN with compiled code).
>>
>> Registration has similar benefits to name spaces in R code:
>>
>> - it ensures that the routines used by .C, .Call etc are those in your
>> package (without needing a PACKAGE argument).
>>
>> - it avoids polluting the search space for native routines with those from
>> your package.
>>
>> - it checks the number of arguments passed to .Call/.External, and the
>> number and optionally the type for .C/.Fortran.
>>
>> - it finds native routines faster, especially if 10s of name spaces are
>> loaded.
>>
>> Kurt Hornik and I have written a tool to make adding registration much
>> easier.  From NEWS in R-devel
>>
>>     • Package tools has a new function
>>       package_native_routine_registration_skeleton() to assist adding
>>       native-routine registration to a package.  See its help and §5.4.1
>>       of ‘Writing R Extensions’ for how to use it.  (At the time it was
>>       added it successfully automated adding registration to over 90%
>>       of CRAN packages which lacked it.  Many of the failures were
>>       newly-detected bugs in the packages, e.g. 50 packages called
>>       entry points with varying numbers of arguments and 65 packages
>>       called entry points not in the package.)
>
> Hello, Dr., Ripley.
>
> This is fantastic. Is there a way to install this functionality into
> an existing 3.3.2 installation, or is it exclusive to
> R-deve;/R-3.4-to-be?

You need to run the tool in R-devel to get the skeleton for your 
package.  Everything else will work in any recent version of R.

>
> Thank you,
>
> Avi
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford



More information about the R-devel mailing list